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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Netrelemo
Helper IV
Helper IV

I want to get 3 columns of data from 30 worksheets in a excel workbook into a single 3 column list

So I have a workbook, with 30 odd pages. Each of the pages represents one day of the month, and each sheet contains one day's data. 

Now each sheet has 20 odd columns, of which I am only interested in the first three. 

So basically I have 30 sheets of 3 columns, which I would like to append into one long list. 

The end result will be say, if 100 rows per sheet, then 100 rows x 30sheets x 3 cols = 3,000 rows of 3 cols. 

 

So, I've got the data prepped, but how do I extract and append the content? 

 

 

 

let
    Source = SharePoint.Files("https://.......sharepoint.com/sites/.......", [ApiVersion = 15]),
    #"Filtered Rows" = Table.SelectRows(Source, each (Text.Contains([Extension],".xls"))),
    #"Lowercased Text" = Table.TransformColumns(#"Filtered Rows",{{"Name", Text.Lower, type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Lowercased Text","_"," ",Replacer.ReplaceText,{"Name"}),
    #"Extracted Text Before Delimiter" = Table.TransformColumns(#"Replaced Value", {{"Name", each Text.BeforeDelimiter(_, ".xls"), type text}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Extracted Text Before Delimiter",{{"Date modified", type date}}),
    #"Filtered Rows1" = Table.SelectRows(#"Changed Type", each Text.Contains([Name], "planner")),
    #"Added Custom" = Table.AddColumn(#"Filtered Rows1", "SourceFile", each [Folder Path]&[Name]&[Extension]),
    #"Sorted Rows" = Table.Sort(#"Added Custom",{{"Date modified", Order.Descending}}),

    #"Part 1 filewords" = Table.AddColumn(#"Sorted Rows", "AllFilenameWords", each Text.Split([Name], " ")),
    #"Part 2 MonthNameFound" = Table.AddColumn(#"Part 1 filewords", "MonthNameFound", each List.First( List.Intersect( { [AllFilenameWords], #"MonthNames"[MonthName] } ) )),
    #"Part 3 YearFound" = Table.AddColumn(#"Part 2 MonthNameFound", "YearFound", each List.First( List.Intersect( { [AllFilenameWords], #"YearsOfInterest"[YearOfInterest] } ) )),
    #"Removed Other Columns" = Table.SelectColumns(#"Part 3 YearFound",{"Name", "Date modified", "SourceFile", "MonthNameFound", "YearFound"}),
    #"Sorted Rows1" = Table.Sort(#"Removed Other Columns",{{"YearFound", Order.Descending}, {"MonthNameFound", Order.Descending}}),
    #"Filtered Rows2" = Table.SelectRows(#"Sorted Rows1", each ([YearFound] = "2023" or [YearFound] = "2024") and ([MonthNameFound] <> null)),
    #"Added Period" = Table.AddColumn(#"Filtered Rows2", "Period", each Date.EndOfMonth(Date.FromText("1 " & [MonthNameFound] & " " & [YearFound]))),

    #"AddedSheetNames" = Table.AddColumn(#"Added Period", "SheetNames", each 
        let
            Source = Excel.Workbook(Web.Contents([SourceFile]), null, true),
            #"Filtered Rows1" = Table.SelectRows(Source, each ([Kind] = "Sheet")),
            #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows1",{"Data", "Item", "Kind", "Hidden"}),
            #"Filtered Rows" = Table.SelectRows(#"Removed Columns", each (Text.Contains([Name],"-"))),
            NamedSheets = Table.ToList(#"Filtered Rows")
in
    #"NamedSheets"
    
    
    )



in
    #"AddedSheetNames"

 

 

I now have a table with a column containing a list of sheetnames. 

How do I pull the data out? 

 

 

 

 

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Follow the instructions in this video - Power Query #08: Import Multiple Excel Sheets From Multiple Excel Workbooks - YouTube


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Netrelemo , Use Table.SelectColumns along with rest of the code I used in video. Means you will promote headers and reduce the column of the sheet before merge

https://learn.microsoft.com/en-us/powerquery-m/table-selectcolumns

 

Power BI - Append Excel sheets into one table| Learn Power BI- https://www.youtube.com/watch?v=lIneR5VTW_8&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1

 

Power Query Table.SelectColumns, Table.RemoveColumns
https://youtu.be/SLCm5zmZasA

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors