Forum Discussion

mvallee's avatar
mvallee
Frequent Visitor
4 years ago
Solved

Combine Excel tables from one column but keeping another column data

Hi,   I need to combine Excel files from a Sharepoint folder, these files sometimes having different column names. So I followed this tutorial : https://www.mssqltips.com/sqlservertip/7182/power-b...
  • MarkLaf's avatar
    4 years ago

    I can see how you may want to avoid needing to explicitly call out which columns you want to expand.

    One solution: add the [ProjetDalux] text values to your tables in [Personnalisé.Data] and then combine as you were before. Something like:

     

    = Table.Combine( 
        List.Transform( 
            Table.ToRecords(#"Lignes filtrées"), 
            (row) => Table.AddColumn( row[Personnalisé.Data], "ProjetDalux", each row[ProjetDalux], type text ) 
        ) 
    )

     

    Edit: changed from using Table.ToRows to Table.ToRecords as the latter will work regardless of column order.