Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
Jesse_oudshoorn
Frequent Visitor

Import multiple tables from excel file in dataflow gen 2

Hi all, I have an excel file that is stored in a Sharepoint folder. I am trying to ingest all tables within this file that start with 'tbl_' into a lakehouse. I tried to do this with the Dataflow Gen 2 & Sharepoint folder connector, however, I am only able to select one of these tables at the time:

 

Jesse_oudshoorn_0-1734962134483.png

 

There will be more tables added into this file that start with 'tbl_' in the future and I would like to run a daily refresh on this dataflow as to get all these tables updated everyday. Is there a possibility to ingest all tables that start with 'tbl_' dynamically into the lakehouse via this way? Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Jesse_oudshoorn ,

 

Thanks for the reply from lbendlin .

 

I understand your need now, currently it is not possible to use Dataflow Gen2 refresh to write different tbl_ tables to lakehouse, more steps need to be done manually.

 

Here is the test I did, I stored the excel file named summarizeTable in SharePoint with 5 tables starting with tbl_.

vhuijieymsft_0-1735012927165.png

 

Don't select the combine option, which will put us in a situation where we can only select one table, just click create.

vhuijieymsft_1-1735012927169.png

 

You can see that the binary file inside content contains five tables.

vhuijieymsft_2-1735012941911.png

vhuijieymsft_0-1735013007175.png

 

Click on Advanced Editor and enter the code below, this will show you the table name and the corresponding table.

vhuijieymsft_4-1735012941916.png

 

let
    Source = SharePoint.Files("your_sharepoint_site", [ApiVersion = 15]),
    ExcelFile = Source{[Name="your_table.xlsx"]}[Content],
    ExcelTables = Excel.Workbook(ExcelFile),
    FilteredTables = Table.SelectRows(ExcelTables, each Text.StartsWith([Name], "tbl_")),
    TableNames = Table.Column(FilteredTables, "Name"),

    // Define a function to process each table
    ProcessTable = (tableName as text) as table =>
        let
            TableData = Table.SelectRows(ExcelTables, each [Name] = tableName){0}[Data],
            PromotedHeaders = Table.PromoteHeaders(TableData, [PromoteAllScalars=true])
        in
            PromotedHeaders,

    // Iterate through each table to generate separate table objects
    Result = List.Transform(TableNames, each [Name = _, Data = ProcessTable(_)]),
    ExpandedResult = Table.FromRecords(Result)
in
    ExpandedResult

 

 

If you want to use a single table, you can click [Table] and add it as a new query.

vhuijieymsft_1-1735013025934.png

 

Remember to rename the query and this is what the data will look like on display. Now you can set the destination to load it into lakehouse.

vhuijieymsft_2-1735013025938.png

 

It's a workaround, and I understand it's a pain in the ass, but there's currently no automated process in dataflow gen2 that I'm aware of that automatically loads tables from different Queries into lakehouse.

 

If you want to write it all at once you can use this code in the advanced editor, but this is less intuitive and I don't think it's as good as the first method.

 

let
    Source = SharePoint.Files("your_sharepoint_site", [ApiVersion = 15]),
    ExcelFile = Source{[Name="your_table.xlsx"]}[Content],
    ExcelTables = Excel.Workbook(ExcelFile),
    FilteredTables = Table.SelectRows(ExcelTables, each Text.StartsWith([Name], "tbl_")),
    ExpandedTables = Table.ExpandTableColumn(FilteredTables, "Data", Table.ColumnNames(FilteredTables{0}[Data])),
  #"Removed columns" = Table.RemoveColumns(ExpandedTables, {"Name", "Item", "Kind", "Hidden"}),
  #"Promoted headers" = Table.PromoteHeaders(#"Removed columns", [PromoteAllScalars = true]),
  #"Changed column type" = Table.TransformColumnTypes(#"Promoted headers", {{"ProductName", type text}})
in
    #"Changed column type"

 

vhuijieymsft_3-1735013139575.png

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Jesse_oudshoorn ,

 

Thanks for the reply from lbendlin .

 

I understand your need now, currently it is not possible to use Dataflow Gen2 refresh to write different tbl_ tables to lakehouse, more steps need to be done manually.

 

Here is the test I did, I stored the excel file named summarizeTable in SharePoint with 5 tables starting with tbl_.

vhuijieymsft_0-1735012927165.png

 

Don't select the combine option, which will put us in a situation where we can only select one table, just click create.

vhuijieymsft_1-1735012927169.png

 

You can see that the binary file inside content contains five tables.

vhuijieymsft_2-1735012941911.png

vhuijieymsft_0-1735013007175.png

 

Click on Advanced Editor and enter the code below, this will show you the table name and the corresponding table.

vhuijieymsft_4-1735012941916.png

 

let
    Source = SharePoint.Files("your_sharepoint_site", [ApiVersion = 15]),
    ExcelFile = Source{[Name="your_table.xlsx"]}[Content],
    ExcelTables = Excel.Workbook(ExcelFile),
    FilteredTables = Table.SelectRows(ExcelTables, each Text.StartsWith([Name], "tbl_")),
    TableNames = Table.Column(FilteredTables, "Name"),

    // Define a function to process each table
    ProcessTable = (tableName as text) as table =>
        let
            TableData = Table.SelectRows(ExcelTables, each [Name] = tableName){0}[Data],
            PromotedHeaders = Table.PromoteHeaders(TableData, [PromoteAllScalars=true])
        in
            PromotedHeaders,

    // Iterate through each table to generate separate table objects
    Result = List.Transform(TableNames, each [Name = _, Data = ProcessTable(_)]),
    ExpandedResult = Table.FromRecords(Result)
in
    ExpandedResult

 

 

If you want to use a single table, you can click [Table] and add it as a new query.

vhuijieymsft_1-1735013025934.png

 

Remember to rename the query and this is what the data will look like on display. Now you can set the destination to load it into lakehouse.

vhuijieymsft_2-1735013025938.png

 

It's a workaround, and I understand it's a pain in the ass, but there's currently no automated process in dataflow gen2 that I'm aware of that automatically loads tables from different Queries into lakehouse.

 

If you want to write it all at once you can use this code in the advanced editor, but this is less intuitive and I don't think it's as good as the first method.

 

let
    Source = SharePoint.Files("your_sharepoint_site", [ApiVersion = 15]),
    ExcelFile = Source{[Name="your_table.xlsx"]}[Content],
    ExcelTables = Excel.Workbook(ExcelFile),
    FilteredTables = Table.SelectRows(ExcelTables, each Text.StartsWith([Name], "tbl_")),
    ExpandedTables = Table.ExpandTableColumn(FilteredTables, "Data", Table.ColumnNames(FilteredTables{0}[Data])),
  #"Removed columns" = Table.RemoveColumns(ExpandedTables, {"Name", "Item", "Kind", "Hidden"}),
  #"Promoted headers" = Table.PromoteHeaders(#"Removed columns", [PromoteAllScalars = true]),
  #"Changed column type" = Table.TransformColumnTypes(#"Promoted headers", {{"ProductName", type text}})
in
    #"Changed column type"

 

vhuijieymsft_3-1735013139575.png

 

If you have any other questions please feel free to contact me.

 

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

 

Thanks! This works like a charm. I went with the first solution you provided and it gives me what I need! 

lbendlin
Super User
Super User

Look at the Advanced Editor code - you will see the individual navigation steps.  Remove the step that chooses a sheet.  Then add a filter to select the desired sheets (the ones starting with "tbl_"  (which is an unfortunate name for a sheet, btw) and then create your own ingestion routine that you can apply to each of them. Finally combine the resulting tables.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.