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

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

Reply
musasi77
Advocate I
Advocate I

combine multiple excel files have different header into one

Hi,

 

I have multiple excel files which is in SharePoint online folder which looks like below table.

  

 Excel File 1
 01/01/201802/01/201830/01/201831/01/2018
Asia    
EU    
US    

 

 Excel File 2
 01/02/201802/02/201827/02/201828/02/2018
Asia    
EU    
US    

 

Each of the file has a "date" as a table header, it is not fixed because of number of date in that month (28 to 31 days),

I'd like to combine all data by paste it next to each other (vertically) to be unpivot, is there any methods to combine it in Power Query?

 

I think creating 1 query per file, and unpivot, then append (or merge) query is mostly simple, but I'd like to automize the job for coming months because I have multiple partners and all of them has same structure of the tables, need to be refresh my dashboard daily basis so it is hard to make it one by one every day.

 

Current "combine files" feature only support adding data below down, it was very hard to rearrange the data for me.

 

Thanks and regards,

Hanwool

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Instead of creating multiple queries and append subsequently, it would be easiest to store all your files in one folder and then use the Import from folder method. But instead of using Binary combine, write your own custom function that unpivots first, before combining all results from the different sources.

Check these sources on how to write your own function:

https://blog.crossjoin.co.uk/2016/05/15/creating-m-functions-from-parameterised-queries-in-power-bi/

https://www.youtube.com/watch?v=Ar_fV_oXSNs&t=3s

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Community Champion
Community Champion

Instead of creating multiple queries and append subsequently, it would be easiest to store all your files in one folder and then use the Import from folder method. But instead of using Binary combine, write your own custom function that unpivots first, before combining all results from the different sources.

Check these sources on how to write your own function:

https://blog.crossjoin.co.uk/2016/05/15/creating-m-functions-from-parameterised-queries-in-power-bi/

https://www.youtube.com/watch?v=Ar_fV_oXSNs&t=3s

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Thank you very much, actually my files are in the Sharepoint Online folders but I found a solution from the linked pages.

 

Cheers!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.