I have .xls files, each with 1 tab, where the table name is in the format CustomerReport_ddMMyyyyhhmmss
Is it possible to add a wildcard to the SELECT statement like the below (the below doesn't work)so I can input multiple tables without specifying every table name:
SELECT * FROM `CustomerReport_%$`
Solved! Go to Solution.
Is the sheet name always the same?
If so it is simple, we simply need to build in the wildcard part into the connection string piece within the input tool...
So...
C:\Users\benjnmoss\Desktop\CustomerReport_22022018.xls
which brings through just one file, would become
C:\Users\benjnmoss\Desktop\CustomerReport_*.xls
This will then bring through all files with that prefix with the specified sheet of that first file.
Does this make sense?
Ben
Hi @BenMoss
the file name and the sheet name both vary depending on when it was exported from the source system...
So I have:
Your method:
Takes care of the varying file name, but what about the varying sheet name?
I could manually rename the sheets 'Sheet1' or something generic but trying to avoid this extra step
I found a solution, but it relies on the Filename containing the sheet name, which is fine for my use case.
So the Macro will replace the specific string "CustomerReport_27022018130050" with whatever appears in [Table]
This is what I was going to suggest, though I would have perhaps used the dynamic input rather than the batch macro. Essentially they are doing the same thing mind!
Ben
I tried to use the Dynamic Input but couldn't get it to work so switched to the batch macro
I retried Dynamic Input this morning and now have it working...not sure what I was doing wrong yesterday.