Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Loading multiple tables from a single excel workbook; then, creating separate queries for data model

Hi, All.

 

I am loading an Excel workbook with several tables in it (see screenshot). is there an elegant way to turn each table (or several tables that I filter) into separate queries for the data model?

 

I can create a separate query per table, manually - but, since I have multiple tables, I wonder if there is an automated way to do so.

 

Any help is appreciated! 

 

Thanks!

 

 

 

 

1 Reply

  • v-juanli-msft's avatar
    v-juanli-msft
    Community Support

    Hi Anonymous 

    I'm afraid there is no auto way like just one step could tramsform it to many tables.

    I test with method below:

    add an index column in original table from 1,

    create a function like the following:

    (Sheetindex as number) =>
        let
            Source = #"2 26 xlsx",
            #"Filtered Rows" = Table.SelectRows(Source, each ([Index] = Sheetindex)),
            #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Data"})
        in
            #"Removed Other Columns"

    Then enter 1 or 2,3,4,5 to the "Parameter", invoke, i can get single query of each sheet data, then expand data and promote column headers.

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.