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

How to read and extract CSV file in Azure Blob?

I have succesfully connected to Azure Storage blob and selected the container and loaded. However I get colums like Name, DateCreated, FolderPath.

 

How to read actual values like "Customer", "Sales" from CSV with Power BI?

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

I create a simple csv file, stored it in Azure Blob. In Power BI desktop, I get data from csv file and extract real data. Please follow the following steps.

1. After type the URL and Account Key, please click "Edit", you will turn to Query Edit Navigator as follows.

2.PNG

2. Extend the content(highlighted in black line), you will get the screenshot below. You can design according to your needs, then click "Ok".

3.png
3. You will get the real column data, click "Apply", it will shows in Power BI model.

4.PNG

Here is my Power Query statement.

let
    Source = AzureStorage.Blobs("https://linlstor.blob.core.windows.net/zhang"),
    #"Invoke Custom Function1" = Table.AddColumn(Source, "Transform File from Query1", each #"Transform File from Query1"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Invoke Custom Function2" = Table.AddColumn(#"Renamed Columns1", "Transform File from Query1 (2)", each #"Transform File from Query1 (2)"([Content])),
    #"Removed Other Columns1" = Table.SelectColumns(#"Invoke Custom Function2", {"Transform File from Query1 (2)"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from Query1 (2)", Table.ColumnNames(#"Transform File from Query1 (2)"(#"Sample File (2)"))),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Date", type date}, {"Column1", Int64.Type}, {"Column2", Int64.Type}})
in
    #"Changed Type"


Best Regards,
Angelia

View solution in original post

2 REPLIES 2
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

I create a simple csv file, stored it in Azure Blob. In Power BI desktop, I get data from csv file and extract real data. Please follow the following steps.

1. After type the URL and Account Key, please click "Edit", you will turn to Query Edit Navigator as follows.

2.PNG

2. Extend the content(highlighted in black line), you will get the screenshot below. You can design according to your needs, then click "Ok".

3.png
3. You will get the real column data, click "Apply", it will shows in Power BI model.

4.PNG

Here is my Power Query statement.

let
    Source = AzureStorage.Blobs("https://linlstor.blob.core.windows.net/zhang"),
    #"Invoke Custom Function1" = Table.AddColumn(Source, "Transform File from Query1", each #"Transform File from Query1"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Invoke Custom Function2" = Table.AddColumn(#"Renamed Columns1", "Transform File from Query1 (2)", each #"Transform File from Query1 (2)"([Content])),
    #"Removed Other Columns1" = Table.SelectColumns(#"Invoke Custom Function2", {"Transform File from Query1 (2)"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from Query1 (2)", Table.ColumnNames(#"Transform File from Query1 (2)"(#"Sample File (2)"))),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Date", type date}, {"Column1", Int64.Type}, {"Column2", Int64.Type}})
in
    #"Changed Type"


Best Regards,
Angelia

Hi @v-huizhn-msft,

 

Similar to this post using Azure blob storage, Is it possible to run a folder query over multiple csv files stored in a Onedrive for Business folder ?

 

If so, what are the correct settings and syntax for the datasource ?

 

let
    Source = AzureStorage.Blobs("https://linlstor.blob.core.windows.net/zhang"),
    #"Invoke Custom Function1" = Table.AddColumn(Source, "Transform File from Query1", .....

 

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.