Re-use headers from one sheet to another

Copper Contributor

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?

1 Reply

@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