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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ashwinkolte
Helper III
Helper III

Combining multiple excel sheets

Hi 

 

Need help with merging multiple excel sheets from a folder in power query . However below are the requirements 

 

1) The number of excel sheets in the folder could vary . It could be as high as 8-10 excel files.  

2) There is no pattern to the name of the excel files.  

3) In all the files , first column has exactly same data. This means the number of records in all files willl be exactly the same. However the name of the first column in each file is different . The first column datatype would be a text column 

3) All remining columns in all files (except the first column) , carry different type of data and have completely different signifcance  . Each file could have as many as 10-12 columns each

4) The user will keep files in the folder and on refresh , the model should be able to pick the files, whichever are present in the folder at that point in time  and merge them. (As already mentioned in point 1 , the number of files in the folder could vary from time to time ) 

5) Data cleansing could be required . Especially removing some blank rows in the files.   

 

Just to illustrate the above requirements , refer the screesnshot below for the required output 

 

ashwinkolte_0-1694617952723.png

 

Thanks

Ashwin

1 REPLY 1
amitchandak
Super User
Super User

@ashwinkolte , Merge query is an option but that will for fixed sheets.

 

refer if this type of code with loop on table rows can work

Merge Queries, Why not Merge the code: https://youtu.be/YOFs39RCPfQ

 

Refer next video what I mean by table row for sheets

 

You have to all these operation in a column. I have used append.

 

But before append, you have two unpivot also in column  and then append pivot

 

After the promote header, unpivot in the same column

https://youtu.be/lIneR5VTW_8

unpivot other

 

Column name are different use , unpivot other

List.First(Table.ColumnNames("Last Step Table Name") )

 

Power Query Table.Unpivot, Table.UnpivotOtherColumns: https://youtu.be/0FEGEAz9UMw

 

Then Append as shown in video

 

and finally pivot

Pivot Data(Power Query) :https://www.youtube.com/watch?v=oKByyI09Bno&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=12

 

I doubt at some stage you need to Table.RenameColumns not List.First(Table.ColumnNames("Last Step Table Name") ) 

 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors