March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
POWER BI GET DATA FROM MULTIPLE EXCEL FILES FROM DIFFERENT FOLDERS HAVING DIFFERENT SHEETS AND COLUMN NAMES
Hi @HSK25
Hope these help:
Proud to be a Super User!
Thanks for a quick reply.
I am sorry i forgot to mention that all the files are in different SharePoint folders. different file names, different worksheet names and different column names. I am interested only in a few columns from each file.
Hi @HSK25
In the tutorial, I used a folder connection as it is a lot faster to connect to files locally stored but still the same concept. You just need to change the connector and instead of being able to directly specify the folder in the connection string, you will need to select the folder by filtering the query. After that you parse the binary files with xlsx extension as Excel workbooks. Below is a sample M script.
let
Source = SharePoint.Files("https://mysharepointsite.sharepoint.com/sites/testsite/", [ApiVersion = 15]),
#"Selected Real Estate Sample folder" = Table.SelectRows(Source, each Text.StartsWith([Folder Path], "https://mysharepointsite.sharepoint.com/sites/testsite/Shared Documents/testfolder/Real Estate Sample/")),
#"Selected xlsx only" = Table.SelectRows(#"Selected Real Estate Sample folder", each [Extension] = ".xlsx"),
#"Removed Other Columns" = Table.SelectColumns(#"Selected xlsx only",{"Name", "Content"}),
#"Parsed binary as Excel" = Table.AddColumn(#"Removed Other Columns", "Excel.Workbook", each Excel.Workbook([Content])),
#"Expanded Excel.Workbook" = Table.ExpandTableColumn(#"Parsed binary as Excel", "Excel.Workbook", {"Data", "Item", "Kind"}, {"Excel.Workbook.Data", "Excel.Workbook.Item", "Excel.Workbook.Kind"}),
#"Selected month worksheets only" = Table.SelectRows(#"Expanded Excel.Workbook", each ([Excel.Workbook.Kind] = "Sheet") and ([Excel.Workbook.Item] <> "2024")),
#"Promoted the first row as headers" = Table.AddColumn(#"Selected month worksheets only", "Table.PromoteHeaders", each Table.PromoteHeaders([Excel.Workbook.Data], [PromoteAllScalars = true])),
#"Removed Other Columns1" = Table.SelectColumns(#"Promoted the first row as headers",{"Name", "Excel.Workbook.Item", "Table.PromoteHeaders"}),
#"Selected a few columns only" = Table.ExpandTableColumn(#"Removed Other Columns1", "Table.PromoteHeaders", {"Serial Number", "Sale Amount", "Property Type", "Assessor Remarks"}, {"Serial Number", "Sale Amount", "Property Type", "Assessor Remarks"})
in
#"Selected a few columns only"
Here is the link to the sample files I used which you need to upload to your own sharepoint account.
Replace this with your sharepoint site base url: https://mysharepointsite.sharepoint.com/sites/testsite/
And this with the folder path: https://mysharepointsite.sharepoint.com/sites/testsite/Shared Documents/testfolder/Real Estate Sample/
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
86 | |
76 | |
57 | |
52 |
User | Count |
---|---|
201 | |
137 | |
108 | |
73 | |
68 |