Forum Discussion

maclura's avatar
maclura
Icon for Resolver I rankResolver I
4 years ago
Solved

Looping throughout a list of tables

Hi, I have a list of tables with an unknown number of items: "SpreadsheetList" I have to consolidate all the tables in a sigle table e.g. with  BigTable = Table.Combine(SpreadsheetList) but, bef...
  • AlexisOlson's avatar
    4 years ago

    You could create a function out of the applied steps but, in this case, it might be simpler to just smash everything together in one step like this:

    BigTable =
    Table.Combine(
        List.Transform(
            SpreadsheetList, each
               Table.UnpivotOtherColumns(
                    Table.PromoteHeaders(_, [PromoteAllScalars=True]),
                    {"Col1", "Col2", "Col3"},
                    "Attribute", "Value"
               )
        )
    )