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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

ExpandTableColumn for csv format using custom column

Hi,

 

How can I expand all the csv format custom table in one go?

 

jeongkim_2-1742874944565.png

 

 

jeongkim_1-1742874934437.png

 

Normally below code works for excel contents but it doesn't seem to work with csv files as all values shows null. 

 

Normally use with excel contents

#"Added Custom" = Table.AddColumn(#"Kept First Rows1", "Custom", each Excel.Workbook([Content])),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Name", "Data", "Item", "Kind", "Hidden"}, {"Custom.Name", "Custom.Data", "Custom.Item", "Custom.Kind", "Custom.Hidden"}),
 
 
 
What I'm trying now:
 
let
// Get list of files in SharePoint folder
Source = SharePoint.Contents("https://XXX.sharepoint.com"),
// Get list of files in SharePoint folder
Documents = Source{[Name="Documents"]}[Content],
// Get list of files in SharePoint folder
#"KR Cell Status" = Documents{[Name="KR Cell Status"]}[Content],
// Get list of files in SharePoint folder
#"LGUplus" = #"KR Cell Status"{[Name="LGUplus"]}[Content],
// Get list of files in SharePoint folder
#"5G_DG1" = #"LGUplus"{[Name="5G_DG1"]}[Content],
#"Removed Other Columns" = Table.SelectColumns(#"5G_DG1",{"Content", "Name"}),
#"Sorted Rows" = Table.Sort(#"Removed Other Columns",{{"Name", Order.Descending}}),
#"Kept First Rows1" = Table.FirstN(#"Sorted Rows",5),
#"Added Custom" = Table.AddColumn(#"Kept First Rows1", "Custom", each Csv.Document([Content])),
#"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Name", "Data", "Item", "Kind", "Hidden"}, {"Custom.Name", "Custom.Data", "Custom.Item", "Custom.Kind", "Custom.Hidden"}),

 
 
So go back to Addded Custom step, 
jeongkim_0-1742880596799.png

 

If I click Table to expand:
 
jeongkim_0-1742880034275.png

 


 

let
// Get list of files in SharePoint folder
Source = SharePoint.Contents("https://XXXX.sharepoint.com/sites/XXX"),
// Get list of files in SharePoint folder
Documents = Source{[Name="Documents"]}[Content],
// Get list of files in SharePoint folder
#"KR Cell Status" = Documents{[Name="KR Cell Status"]}[Content],
// Get list of files in SharePoint folder
#"LGUplus" = #"KR Cell Status"{[Name="LGUplus"]}[Content],
// Get list of files in SharePoint folder
#"5G_DG1" = #"LGUplus"{[Name="5G_DG1"]}[Content],
#"Removed Other Columns" = Table.SelectColumns(#"5G_DG1",{"Content", "Name"}),
#"Sorted Rows" = Table.Sort(#"Removed Other Columns",{{"Name", Order.Descending}}),
#"Kept First Rows1" = Table.FirstN(#"Sorted Rows",5),
#"Added Custom" = Table.AddColumn(#"Kept First Rows1", "Custom", each Csv.Document([Content])),
#"2025_W11_5G_DG1 csv" = #"Added Custom"{[Name="2025_W11_5G_DG1.csv"]}[Custom]
in
#"2025_W11_5G_DG1 csv"

 

 

 

If I clisk Binary:

jeongkim_0-1742879656136.png

 

 

let
// Get list of files in SharePoint folder
Source = SharePoint.Contents("https://XXX.sharepoint.com/sites/XXX"),
// Get list of files in SharePoint folder
Documents = Source{[Name="Documents"]}[Content],
// Get list of files in SharePoint folder
#"KR Cell Status" = Documents{[Name="KR Cell Status"]}[Content],
// Get list of files in SharePoint folder
#"LGUplus" = #"KR Cell Status"{[Name="LGUplus"]}[Content],
// Get list of files in SharePoint folder
#"5G_DG1" = #"LGUplus"{[Name="5G_DG1"]}[Content],
#"Removed Other Columns" = Table.SelectColumns(#"5G_DG1",{"Content", "Name"}),
#"Sorted Rows" = Table.Sort(#"Removed Other Columns",{{"Name", Order.Descending}}),
#"Kept First Rows1" = Table.FirstN(#"Sorted Rows",5),
#"Added Custom" = Table.AddColumn(#"Kept First Rows1", "Custom", each Csv.Document([Content])),
#"2025_W11_5G_DG1 csv" = #"Added Custom"{[Name="2025_W11_5G_DG1.csv"]}[Content],
#"Imported CSV" = Csv.Document(#"2025_W11_5G_DG1 csv",[Delimiter=",", Columns=54, Encoding=1252, QuoteStyle=QuoteStyle.None])
in
#"Imported CSV"

 

 

 

How csv looks:

jeongkim_0-1742881196361.png

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Anonymous 

 

Use Csv.Document function. Sample code

Table.PromoteHeaders( Csv.Document([Content], [Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.Csv]), [PromoteAllScalars = true])

[Content] refers to the binary column

danextian_0-1742889521719.png

Since your colum header is not in row 1, you will need to skip a row before applying Table.PromoteHeaders

Table.PromoteHeaders( Table.Skip( Csv.Document([Content], [Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.Csv]), 1), [PromoteAllScalars = true])




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

1 REPLY 1
danextian
Super User
Super User

Hi @Anonymous 

 

Use Csv.Document function. Sample code

Table.PromoteHeaders( Csv.Document([Content], [Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.Csv]), [PromoteAllScalars = true])

[Content] refers to the binary column

danextian_0-1742889521719.png

Since your colum header is not in row 1, you will need to skip a row before applying Table.PromoteHeaders

Table.PromoteHeaders( Table.Skip( Csv.Document([Content], [Delimiter=",", Encoding=1252, QuoteStyle=QuoteStyle.Csv]), 1), [PromoteAllScalars = true])




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.