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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
lf2606
Frequent Visitor

Combine multiple files with different sheet names and different sheet index

I have a folder with one .xslm for each day of the month (named February 1, February 2, ..., February X), within each workbook, there's one sheet named after the day of the month in the same manner as the file names (February 1, February 2, ..., February X). The structure of the sheets is identical for all of them.  The sheets have different index numbers, so using the "Source{0}[Data]" method is not working. 

 

Is there a way to use something like Text.Contains or similar to pull all the worksheets ?

 

I'm not very familiar with Power Query code, but conceptually this is what I would like to do:

 

lf2606_0-1678760838600.png

 

 

Where XYZ = "February".

 

Thank you!

 

6 REPLIES 6
wdx223_Daniel
Super User
Super User

=Table.SelectRows(Origen,each Text.Contains([Item],"February") and [Kind]="Sheet")

Thanks for the reply, after running that query for the example file, I got this outcome: 

 

lf2606_0-1678766281955.png

 

But I get this error for the other query:

 

lf2606_1-1678766316996.png

 

Would you happen to know what's causing it? 

 

 

this error came from your file have not the column name of "Column1"

strongly suggest you never use fixed column name in your code, unless you can keep the name exists in all your source files.

I'm sorry for making such basic questions, but I'm not able to resolve it: 

 

 

If I start from scratch and pull the files from the folder and click on combine and transform, then select the desired sheet from example file this is what it looks like: 

 

lf2606_0-1678812086245.png

 

The key error related to the sheet name at the bottom, but the query at the top shows that code for creating column names automatically. 

 

If I change the query from the navigation step at the Transform sample file to the one you kindly provided it looks like this: 

 

 

lf2606_1-1678812191819.png

 

 

and at the final load I see this: 

 

lf2606_2-1678812261270.png

 

And I am unable to load the data.  

 

I didn't exactly hardcode those column names, I believe they were created automatically from the moment I loaded the files from the folder. 

 

How can I go around this so I can get the desired result of loading all data from the desired sheets?

 

Thank you!

Hello, @lf2606 locate the step which gives you this error and show us the code of that step. 

lf2606
Frequent Visitor

Would anybody happen to know what would be the appropriate next steps to solve this issue? 

 

Thanks!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors