Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Change the Excel source to an azure blob storage

Hi guys,

you can change the source in the Power Query from an Excel file to an Azure Blob storage. The structure remains exactly the same - only the source changes?

 

thanks in advance

greetings lukas

1 ACCEPTED SOLUTION
edhans
Super User
Super User

Hi @Anonymous - you didn't say how you were connecting to the Excel file - local drive, SharePoint, etc. However, the change is pretty straight forward.

 

If you open the advanced editor of your Excel queries you might see something like this:

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\username\OneDrive\Purchasing Wait List.xlsx"), null, true),
    OldBookList_Table = Source{[Item="OldBookList",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(OldBookList_Table,{{"Date", type date}, {"Title", type text}, {"Author", type text}, {"Category", type text}, {"Priority", Int64.Type}, {"Comments", type text}, {"Date Started", type any}})
in
    #"Changed Type"

 

What you need to do is connect to the Azure Storage Blob the way you normally would, then get the query editor down to the same place as where I have the #"Changed Type" step, as that is where the real work begins.

 

Then, you copy those first 2-3 Azure Storage lines in the advanced editor and replace the first 2/3 lines of your Excel queries. A few notes:

  1. The lines you copy must all have a comma at the end. The last step may not, but if copy that last Azure Storage Blob step, manually add a comma
  2. If the step names change, say at line 4, make sure the table name referenced in line 4 is what is shown in line 3. So in my step above I have a step called OldBookList_Table. Maybe when I connect with ASB it is called #"Create connection" - (I made that up, this is an example. So the Changed Step would need to remove OldBookList_Table and replace it with #"Create connection." The #"name here" syntax is needed if there are spaces or special characters in the step names.

See the instructions below too as they can walk you through the process.

See this article if you need help using this M code in your model.

 

If you need specific help, do the following:

  • Post the M code for your Excel files here, using the code box </> icon in the ribbon
  • Post the M code for your ASB queries here using the same code box.

I or someone else can assist in merging the code.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

Hi @Anonymous - you didn't say how you were connecting to the Excel file - local drive, SharePoint, etc. However, the change is pretty straight forward.

 

If you open the advanced editor of your Excel queries you might see something like this:

 

let
    Source = Excel.Workbook(File.Contents("C:\Users\username\OneDrive\Purchasing Wait List.xlsx"), null, true),
    OldBookList_Table = Source{[Item="OldBookList",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(OldBookList_Table,{{"Date", type date}, {"Title", type text}, {"Author", type text}, {"Category", type text}, {"Priority", Int64.Type}, {"Comments", type text}, {"Date Started", type any}})
in
    #"Changed Type"

 

What you need to do is connect to the Azure Storage Blob the way you normally would, then get the query editor down to the same place as where I have the #"Changed Type" step, as that is where the real work begins.

 

Then, you copy those first 2-3 Azure Storage lines in the advanced editor and replace the first 2/3 lines of your Excel queries. A few notes:

  1. The lines you copy must all have a comma at the end. The last step may not, but if copy that last Azure Storage Blob step, manually add a comma
  2. If the step names change, say at line 4, make sure the table name referenced in line 4 is what is shown in line 3. So in my step above I have a step called OldBookList_Table. Maybe when I connect with ASB it is called #"Create connection" - (I made that up, this is an example. So the Changed Step would need to remove OldBookList_Table and replace it with #"Create connection." The #"name here" syntax is needed if there are spaces or special characters in the step names.

See the instructions below too as they can walk you through the process.

See this article if you need help using this M code in your model.

 

If you need specific help, do the following:

  • Post the M code for your Excel files here, using the code box </> icon in the ribbon
  • Post the M code for your ASB queries here using the same code box.

I or someone else can assist in merging the code.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors