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

Multiple excel sheets loading at a time?

Hi Folks,

I have a Excel file Sample.xlsx

it contains sheet names having different names like this AAA,BBB,CCC,DDD (but structure is same in all sheets.the field names all are same)

then how can i fetch all the sheets at atime in one load statement.

Plz help me on this.

regards,

Rakesh

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Rakesh,

Manually enter below line in script

ODBC CONNECT TO [Excel Files;DBQ=C:\Users\Source\YourExcelFileName.xlsx];

XlsTables:
SQLTables;

XlsTables:  and  SQLTables will create field TABLE_NAME with list of sheetnames as rows.

the below code will loop thru this rows and loads data from the  sheets in excel file.


LET vRows = NoOfRows('XlsTables');


FOR i = 0 TO $(vRows)-1

LET vSheetName = subfield(peek('TABLE_NAME', i,'XlsTables'),'$',1);

$(vSheetName):
LOAD *
FROM [ExcelFile.xlsx]
(
ooxml, embedded labels, table is '$(vSheetName)');

NEXT i

Hope this helps

Regards

Neetha

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Hi Rakesh,

ODBC CONNECT TO [Excel Files;DBQ=ExcelFile.xlsx];

XlsTables:
SQLTables;
DISCONNECT;

LET vRows = NoOfRows('XlsTables');


FOR i = 0 TO $(vRows)-1

LET vSheetName = subfield(peek('TABLE_NAME', i,'XlsTables'),'$',1);

$(vSheetName):
LOAD *
FROM [ExcelFile.xlsx]
(
ooxml, embedded labels, table is '$(vSheetName)');

NEXT i

DROP TABLE XlsTables;

buzzy996
Master II
Master II

Not applicable
Author

Hi neeta,

I am having bit confussion on this.my source is excel so why i need to use odbc

and from wer i will get the field name as TABLE_NAME

Anonymous
Not applicable
Author

Hi,

Try:

ODBC CONNECT TO [Excel Files;DBQ=C:\Users\Source\YourExcelFileName.xlsx];

TABLE_NAME  is field name in xlstables

Not applicable
Author

I don't have any field like TABLE_NAME in my source data

Anonymous
Not applicable
Author

Hi Rakesh,

Manually enter below line in script

ODBC CONNECT TO [Excel Files;DBQ=C:\Users\Source\YourExcelFileName.xlsx];

XlsTables:
SQLTables;

XlsTables:  and  SQLTables will create field TABLE_NAME with list of sheetnames as rows.

the below code will loop thru this rows and loads data from the  sheets in excel file.


LET vRows = NoOfRows('XlsTables');


FOR i = 0 TO $(vRows)-1

LET vSheetName = subfield(peek('TABLE_NAME', i,'XlsTables'),'$',1);

$(vSheetName):
LOAD *
FROM [ExcelFile.xlsx]
(
ooxml, embedded labels, table is '$(vSheetName)');

NEXT i

Hope this helps

Regards

Neetha

Not applicable
Author

thank u so much neeta... i vl try