Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

danielnevitt
Contributor

Loading multiple xlsx files

Hi,

We have a file (edw2iceyyyy-mm-dd-hh-mm-ss) that is loaded to location on daily basis (see attachment).

Is it possible to load multiple files using variables?

For example, I would like to load the most recent 10 files and I wondered if there was a simple way to do this?

Any help would be much appreciated.

Regards,

Daniel

9 Replies

Re: Loading multiple xlsx files

Try it with the wild card (*)

FROM Path\edw2ice*.xslx;

Just make sure that all the Excel files have same format (tab names, field names etc)

Partner
Partner

Re: Loading multiple xlsx files

Hi Daniel,

I have had the same issue. The below thread help:

Load multiple excel files from Multiple excel sheetsinto QV

danielnevitt
Contributor

Re: Loading multiple xlsx files

Thank you for the responses.  I think adding the * solves my issue.

One other question I have, is there a way to either split the below data when loaded or in the qvw file?

I'm trying to show for example; RPBQV, 0000000000012015083141, OXD, 201508 as separate columns.

Thanks,

Daniel


EDW1.JPG

Re: Loading multiple xlsx files

I think if you share a sample, we might be able to give you a better solution. Can you share one of the excel files?

danielnevitt
Contributor

Re: Loading multiple xlsx files

I don't seem to have the option to add an excel file?

Re: Loading multiple xlsx files

Step 1:

Capture.PNG

Step 2:

Capture.PNG

danielnevitt
Contributor

Re: Loading multiple xlsx files

Thanks Sunny.  Unfortunately I don't see that option on my screen:

Capture.JPG

Re: Loading multiple xlsx files

Try this script:

Table:

LOAD SubField(A, ' ', 1) as 1,

  SubField(A, ' ', 2) as 2,

  SubField(A, ' ', 3) as 3,

  SubField(A, ' ', 4) as 4

FROM

Community_178850.xlsx

(ooxml, no labels, table is Sheet1);


Capture.PNG

neetha_p
Honored Contributor

Re: Loading multiple xlsx files

hi daniel,

FOR EACH file in FileList('filepath\edw2ice*.xlsx');

//In order to get the file information from SQLtables command making use of the ODBC connection format

ODBC CONNECT32 TO [Excel Files;DBQ=$(file)];

tables:

SQLtables;

DISCONNECT;

FOR i = 0 to NoOfRows('tables')-1

LET sheetName = Peek('TABLE_NAME', i, 'tables');

Table:

Load * ,

FileBaseName()as FIle,

FileDir() as Dir,

FileName() as File_Name,

'$(sheetName)' as Sheet_name,

  SubField(Field,' ', 1) as Field1,

  SubField(Field,' ', 2) as Field2,

  SubField(Field,' ', 3) as Field3,

  SubField(Field,' ', 4) as Field4

From $(file)(ooxml, embedded labels, table is [$(sheetName)]);

NEXT i

Next

Regards

Neetha