Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello -
My data source is an Excel (.xlsx) file with four (4) sheets, each with a different name and different data on each.
I know how to do a loop script when the data has the same fields on each sheet, but wondering if this is possible with different data.
My sheet names are 'traffic' 'duration' 'referrer' 'content'
Thank you.
Since the fields are different, the only thing you can do is load them with the generic "*" for all fields and no transformations. Something like this (typing it from memory, so forgive me if the syntax is not exact:)
FOR EACH vSheet IN 'traffic', 'duration', 'referrer', 'content'
$(vSheet):
LOAD
*
FROM
[... file name ... Table=$(vSheet)]
;
NEXT
Something along these lines... Copy the exact syntax of the FROM clause from the File Wizard.
cheers,
Oleg Troyansky
Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy!
Since the fields are different, the only thing you can do is load them with the generic "*" for all fields and no transformations. Something like this (typing it from memory, so forgive me if the syntax is not exact:)
FOR EACH vSheet IN 'traffic', 'duration', 'referrer', 'content'
$(vSheet):
LOAD
*
FROM
[... file name ... Table=$(vSheet)]
;
NEXT
Something along these lines... Copy the exact syntax of the FROM clause from the File Wizard.
cheers,
Oleg Troyansky
Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy!
Sorry, I actually couldn't get this to work:
Directory 'Q:\qlkvw\prod\data\digital\HC';
FOR EACH vSheet in 'traffic', 'duration', 'referrer' , 'content';
$(vSheet):
LOAD
*
FROM
(ooxml, embedded labels, Table is $(vSheet);
NEXT
May be something like this for the attached sample
for Each file in 'A' , 'B'
Table$(file):
LOAD *
FROM
Community_205639.xlsx
(ooxml, embedded labels, table is $(file));
NEXT
You have a extra semi-colon at the end of FOR statement and you need to remove that:
In addition you are also missing a closing parenthesis at the end of your load statement: