Forum Discussion

lf2606's avatar
lf2606
Frequent Visitor
3 years ago

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:

 

 

 

Where XYZ = "February".

 

Thank you!

 

6 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

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

    • lf2606's avatar
      lf2606
      Frequent Visitor

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

       

       

      But I get this error for the other query:

       

       

      Would you happen to know what's causing it? 

       

       

      • wdx223_Daniel's avatar
        wdx223_Daniel
        Community Champion

        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.