Showing results for 
Search instead for 
Did you mean: 
New Member

Combine Multiple Worksheets with Different Order of Columns

Dear members,


The task in hand is to combine data from multiple workbooks from a local folder in my computer. I wanted to use Power Query to combine data from all the files and perform certain transformation and then consolidate data into single worksheet. This task is easy when the individual workbooks are of the same template (same number of Columns in the same order). However, the challenge is that the various workbooks that we receive are of different templates (the Columns are not in the same order). In some workbooks we have 10 Columns, while in some we have 20+ columns (the number of Columns are dynamic and cannot be controlled).  We have to collate data from 1st 5 Columns in a certain workbook, while these 5 Columns are in a different Columns in other workbooks. The only thing that is common across all workbooks are that they have the same Column Header.

Is there a way how this can be achieved via Power Query? Below are sample reports with different column order. What we need is to collate data from Column 1, Column 2, Column 3, Column 4 and Column 5 (as highlighted in Red font). 


Report 1.xlsx

Column 1Column 2Column 3Column 4Column 5Column 6Column 7Column 8Column 9Column 10


Report 2.xlsx

Column 6Column 7Column 8Column 9Column 10Column 1Column 2Column 3Column 4Column 5


Report 3.xlsx

Column 6Column 1Column 7Column 2Column 8Column 3Column 4Column 5Column 9Column 10


I thank everyone who puts their time and effort to review this situation and provide a solution to achieve this in Power Query.




Community Support
Community Support

Hi @ragav_in ,


Did you want to merge with multi tables?

In the Merge feature, catching columns can have multiple columns, hold down Ctrl and then multi-select.

Tutorial: Shape and combine data in Power BI Desktop - Power BI | Microsoft Learn



Best Regards,

Stephen Tao


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Champion
Community Champion

@ragav_in If names of columns that you want to retain are same across all workbooks then you can just write a simple code to select only those columns?

    Source = Folder.Contents ( "C:\Users\SharmaAnt\Downloads\ColumnsTest" ),
    KeepContent = Table.SelectColumns ( Source, { "Content" } ),
    ColumnsToKeep = List.Transform ( { 1 .. 5 }, each "Column " & Text.From ( _ ) ),
    AddedCustom = 
        Table.AddColumn (
            Table.SelectColumns (
                Table.SelectRows ( 
                    Excel.Workbook ( [Content] ), 
                    each [Kind] = "Table" 
    RemovedOtherColumns = Table.SelectColumns ( AddedCustom, { "Custom" } )


Helpful resources

Exciting changes

Power BI Community Changes

Check out the changes to the Power BI Community announced at Build.

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Kudo Data Story carousel

Data Stories Gallery

Visit our Data Stories Gallery and give kudos to your favorite Data Stories.

Top Solution Authors
Top Kudoed Authors