I'm uploading several Excel files in Qlik Sense. I know their name and I don't want to loop over all files, but just to read the name of the sheets (I don't know if I've been clear, for file I mean test.xlsx and the sheets are within the file like Sheet1, Sheet2,...) in order to put them in a field.
So I've got this situation:
(ooxml, embedded labels, table is Sheet1);
and I want to read "Sheet1" and put it in a field.
How could I do it? I tried with different macro using the ActiveDocument.ActiveSheet.GetProperties.Name method, but I did'n get what I wanted.
Your question is a bit confusing: Are you trying to extract the Sheet Name during the load and create a special field with it? Or are you trying to modify your script to load all sheets into different tables (named by each Excel sheet) in one script?
I think the best way in your case is to use the following:
TableName(n) as TableName
The only problem is that Qlik requires a 'n' to be defined "as number of the specified table". The first table has number 0. This number should be based on number of tables currently in memory (based on the sequence of the load, I believe)...
I did not have chance to test it, but you should be able to drop each table after each loading statement (since you can save it into QVD anyway), so in this case the 'n' could always be 0 (since only one table will be loaded at a time).
Hopefully, this solution will work for you.
P.S. When applicable, please mark this answer Correct or Helpful.