Query from folder - different worksheet Names

Will_Texas

New member
Joined
Dec 20, 2021
Messages
16
Reaction score
1
Points
3
Location
Houston, Texas
Excel Version(s)
365
Hello, I have a query from a Folder that has three excel files. The query works, but only if all the .xls files have the same worksheet name.
I will likely have many files over time in the Folder & don't want to have to change it every time.

Does anyone know how I can change the query function to get around this worksheet reference?
 
Could you post the M-code?
 
Yes, but after that first file import is done, of the first worksheet, it seems to append the Source to worksheets of that name, and if other files worksheet names are different than that, then it creates an error for (only) those files.

I've attached a screenshot of (at least my issue).
 

Attachments

  • Different Worksheet Names.jpg
    Different Worksheet Names.jpg
    97.2 KB · Views: 13
Are you saying that happened AFTER you had made the change to import by index number?
 
Back
Top