Forum Discussion

MikeBlair's avatar
MikeBlair
Copper Contributor
Apr 05, 2023

Re-use headers from one sheet to another

I have an Excel where I want to combine the two using power query.  This is very easy when the both sheets have the identical headers but sheet 2 has none.  I can copy and paste the headers in and it works but can I use Power Query to do this for me?

  • MikeBlair 

    That could be like

    // Query2
    let
        Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content], 
        names = Table.ColumnNames( Query1 ),
        rename = Table.RenameColumns( Source, List.Zip( { Table.ColumnNames(Source), names } ) )
    in
        rename

Resources