Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nevilledhamsiri
Specialist
Specialist

Dta loading from different sheets

The steps given here once applied error comes as script line error. Will some one correct me where I am wrong as per the excel given below.

FOR i = 0 to 3

LOAD [BRANCH]

   [ PROFITS ]

FROM

[excel files\dummy_excel.xlsx]

(ooxml, embedded labels, table is $(i));

NEXT i

regards

Pradosh

 

SHEET-A
BRANCHPROFITS
RA500
RA1250
RA3350
SHEET-B
BRANCHPROFITS
EM500
EM1250
EM2350
SHEET-C
BRANCHPROFITS
KW500
KW1250
KW2350
1 Solution

Accepted Solutions
Anil_Babu_Samineni

Not sure, why not for you?

PFA the excels and code is same

Qlikview I got like below

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

7 Replies
Anil_Babu_Samineni

May be this?

FOR i = 0 to 3

LOAD [BRANCH]

  [ PROFITS ]

FROM

[excel files\dummy_excel.xlsx]

(ooxml, embedded labels, table is [sheet$(i)]);

NEXT i

Note - sheet means your default sheet names. If you have 1,2,3... normally $(i) should work..

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
mdmukramali
Specialist III
Specialist III

Dear,

You can Try Anil Solution.

and also you can try the below solution if you have static Sheet Tab names:

FOR Each vSheetNames IN 'SHEET-A','SHEET-B','SHEET-C'

LOAD [BRANCH]

   [ PROFITS ]

FROM

[excel files\dummy_excel.xlsx]

(ooxml, embedded labels, table is [$(vSheetNames)];

NEXT

Thanks,

Mukram

Frank_Hartmann
Master II
Master II

If you have sheetnames in excel without any structure (e.g Sales, Country, Expense,.....)

you could try attached solution

hope this helps

nevilledhamsiri
Specialist
Specialist
Author

Hi, Anil,

Once I loaded the data as follows, an error comes as "script line error" please check where I am wrong. Dear Mohomed, Your solution did work. Thanks

FOR i= A to C

LOAD BRANCH,

     PROFITS

FROM

[..\DIFFERENT SHEETS.xlsx]

(ooxml, embedded labels, table is $(A));

NEXT i

Anil_Babu_Samineni

In my way, variable should be allocate to sheet numbers because variable can create automate passing loops.

Not sure, how your sheet names looks like..

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
nevilledhamsiri
Specialist
Specialist
Author

Dear Anil,

See the data in excel, I have given what is in three sheets which are in same field headers. If that is the case, is it wrong the way I have loaded the data?

Neville.

You may if possible write it in the script for the data to be loaded which are in three sheets

Anil_Babu_Samineni

Not sure, why not for you?

PFA the excels and code is same

Qlikview I got like below

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful