Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading data from diffrent folder at a time

my data are in this location i have to load all the date at a time

[..\Data Source\28-Jan-2016\NT\Change_in_Book_and_Market_Value_28-01-16.XLS]

[..\Data Source\29-Jan-2016\NT\Change_in_Book_and_Market_Value_29-01-16.XLS]

[..\Data Source\01-Feb-2016\NT\Change_in_Book_and_Market_Value_01-02-16.XLS]

[..\Data Source\02-Feb-2016\NT\Change_in_Book_and_Market_Value_02-02-16.XLS]


can u hlep me please

1 Solution

Accepted Solutions
senpradip007
Specialist III
Specialist III

Try to use below script.

for i = num(date#(vStartDate, 'DD-MM-YYYY')) to vEndDate

  let vTemp = text(date($(i), 'DD-MMM-YYYY'));

  if not (WeekDay(date($(i))) = 'Sat' or WeekDay(date($(i))) = 'Sun') then

       LOAD

                 ID,

                Type,

                Data

       FROM

       [..\Data Source\$(vTemp)\NT\*.XLS]

       (ooxml, embedded labels, table is Sheet1);

  ENDIF

next

View solution in original post

13 Replies
senpradip007
Specialist III
Specialist III

Could you please share the script?

bindu_apte
Creator III
Creator III

Hi,

If you wanted load all these excels at a time then please create a folder and from there you can just load all excels as per name.

ie., something like this.

[\Data Source\NT\Change_in_Book_and_Market_Value_*.xls

Not applicable
Author

pradip to be frank i cannot share the script and i have a folder called data source in it the files are sepreated by date as folder name. inside Date folder i have a folder called NT in all the folders.Inside the NT folder i have my file which i have to load at a time 

senpradip007
Specialist III
Specialist III

Try like

for i = num(date#(vStartDate, 'DD-MM-YYYY')) to num(date#(vEndDate, 'DD-MM-YYYY'))

  let vTemp = text(date($(i), 'DD-MMM-YYYY'));

  LOAD

  ID,

      Type,

      Data

  FROM

  [..\Data Source\$(vTemp)\NT\*.XLS]

  (ooxml, embedded labels, table is Sheet1);

next

As your forder names consist of date , take input of Minimum Date and Maximum Date from front end. Here vStartDate consists of Mininum Date and vEndDate consists of Maximum Date.

Not applicable
Author

pradip thanks for your help man but i have doubt if i assign start date and end date there might be even saturday and sunday in middle it might give an error

jonathandienst
Partner - Champion III
Partner - Champion III

This perhaps:

For Each vDir in DirList('..\Data Source\*')

    LOAD *,

        FileBaseName() as Source

    FROM $(vDir)\NT\*.xls

  (biff, embedded labels, table is Sheet1);

Next


Assumes that all the files have the same fields. Adapt the dirlist path and the load statement for your requirements.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

but i have the folder in daily date from 1-01-2016 to 28-02-2016 except weekends i have to retrive the file on the date

28-01-2016,

29-01-2016,

01-02-2016,

02-02-2016

senpradip007
Specialist III
Specialist III

Try to use below script.

for i = num(date#(vStartDate, 'DD-MM-YYYY')) to vEndDate

  let vTemp = text(date($(i), 'DD-MMM-YYYY'));

  if not (WeekDay(date($(i))) = 'Sat' or WeekDay(date($(i))) = 'Sun') then

       LOAD

                 ID,

                Type,

                Data

       FROM

       [..\Data Source\$(vTemp)\NT\*.XLS]

       (ooxml, embedded labels, table is Sheet1);

  ENDIF

next

Anonymous
Not applicable
Author