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

Be 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

Reply
HSK25
Regular Visitor

COMBINE MULTIPLE EXCEL FILES FROM DIFFERENT FOLDERS

POWER BI GET DATA FROM MULTIPLE EXCEL FILES FROM DIFFERENT FOLDERS HAVING DIFFERENT SHEETS AND COLUMN NAMES

3 REPLIES 3
danextian
Super User
Super User

Hi @HSK25 

 

Hope these help:

https://youtu.be/AzMaf42DmM0 

https://youtu.be/zhCWiIwO8dQ 

 










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


Proud to be a Super User!









"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.

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"

 

danextian_1-1733019031919.png

 

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/

 










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


Proud to be a Super User!









"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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.