Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I have, for example, an xls. file with several sheets.
Each sheet contains the same tables structure (same number of columns and rows, they only differ in the cell values).
The sheets are named as follows: L_A, L_B, L_C
The fields have identical names in all sheets: x,y,z
Objective:
To load with for loop (incrementing in the list {A,B,C}) from the sheets (L_A, L_B, L_C) the fields (x,y,z) as (x_A,x_B,x_C,Y_A,..).
Can anyone help me?
Many thanks in advance
you can do however you want it, in you load statement, you can specify NOCONCATENATE and you can embed your sheetname into the field names, you can even use the variable in the tablename
for Each vSheet in 'A','B','C'
NoConcatenate
Sheet$(vSheet):
LOAD x as x$(vSheet),
y as y$(vSheet),
z as z$(vSheet)
FROM
[file.xlsx]
(ooxml, embedded labels, table is $(vSheet));
next;
look at this post:
Solved: Load multiple sheets from Excel Files - Qlik Community - 1595476
My imported fields should be imported separtely and not concatenated in one field ( e.g. Field a from Sheet 1 and field a from Sheet 2 should be imported as a1 from Sheet 1 and as a2 from Sheet 2).
(In my case not numerical index but the index should be taken from a list of names)
you can do however you want it, in you load statement, you can specify NOCONCATENATE and you can embed your sheetname into the field names, you can even use the variable in the tablename
for Each vSheet in 'A','B','C'
NoConcatenate
Sheet$(vSheet):
LOAD x as x$(vSheet),
y as y$(vSheet),
z as z$(vSheet)
FROM
[file.xlsx]
(ooxml, embedded labels, table is $(vSheet));
next;
obviously, if your sheet is L_A, L_B, etc..
use A, B, C as the variable value and just add L_ in the sheet name
... table is L_$(vSheet)
itll be easier