Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Loading multiple excel files~

Hello,

Just want to ask on what is the work around when loading multiple excel files. given the file names are months and years.

ex: Jan2012, Feb2012, Mar2012, Apr2012, so on...~

Thanks,

Donna

8 Replies
sreenivas
Contributor III

Re: Loading multiple excel files~

Not applicable

Re: Loading multiple excel files~

Hi thanks, but i'm looking for load of multiple 'Files'~ what you have given me is multiple sheets. but thanks for the idea!

khadeer_sparks
Valued Contributor

Re: Loading multiple excel files~

Hi,

If u want the data for total months, just conncatenate all excell file, but remember all the fields are common in excell file r same.

Suppose in Jan excel file

Month, Region, Amount

1,XXX,100

1,YYY,200

In Feb

Month, Region, Amount

2,XXX,100

2,YYY,200

when u r concatenating these u get

Month, Region, Amount

1,XXX,100

1,YYY,200

2,XXX,100

2,YYY,200

when selecting months u will get the desired result based on ur selection.

Not applicable

Re: Loading multiple excel files~

it will be much better if I can do it on a loop

phaneendra_kunc
Valued Contributor III

Re: Loading multiple excel files~

See if the below code helps..

FileName:

LOAD * INLINE [

  

   File

   Jan2012

   Feb2012

   Mar2012

];

Data:

Load 1 as Dummy AutoGenerate 1;

For i = 0 to NoOfRows(FileName)

Let vFile = Peek('File',$(i),'FileName');

Concatenate (Data)

Load *

FROM

C:\$(vFile).xlsx

(ooxml, embedded labels, table is Sheet1);

Next

Drop Field Dummy;

Not applicable

Re: Loading multiple excel files~

Hi,

If all the files having same structure then why you need loop to load the data.. loops will affect performance..

use like..

load

     fieldnames

from *.xls;

//Chandra

phaneendra_kunc
Valued Contributor III

Re: Loading multiple excel files~

FileName:

LOAD * INLINE [

File

SBBO Metric 20 we 20121124

SBBO Metric 20 we 20121201

SBBO Metric 20 we 20121208

SBBO Metric 20 we 20121215

SBBO Metric 20 we 20121222

];

For i = 0 to NoOfRows(FileName)

Let vFile = Peek('File',$(i),'FileName');

Data:

Load *

FROM

D:\Nirmal Dev\QV Dev\Source\Sales Force\$(vFile).xlsx

(ooxml, embedded labels, table is Sheet1);

Next

Make sure to change the sheet name accordingly...

phaneendra_kunc
Valued Contributor III

Re: Loading multiple excel files~

Change your FOR statement to this.

For i = 0 to NoOfRows('FileName')-1

Community Browser