Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Skipping one of the file from for loop

Hi All,
I want to load data from all the xls in the below folder. But it is loading data from xlsm which exists in one of the below folder. How can I skip xlsm from below and load only from xls?. Please help!

SET ZLoadDirectory = 'C:\data\xyz';

FOR each File in filelist (ZDirectory & '\*.xls')

Load ....
;

NEXT File

4 Replies
agilos_mla
Partner - Creator III
Partner - Creator III

Add a where clause to the load :  Where FileExtension() <> 'xlsm'

(Required to be done in the LOAD because returned at the record level.)

Otherwise you can use a IF:

IF subfield(File, '.', 2) <> 'xlsm' THEN

     LOAD ...;

END IF

Next

luis_pimentel
Partner - Creator III
Partner - Creator III

  1. SET ZLoadDirectory = 'C:\data\xyz'
  2. FOR each File in filelist (ZDirectory & '\*.xls'
  3. IF RIGHT($(File),3) = 'xls' THEN
  4. Load .... 
  5. ENDIF
  6. NEXT File
Not applicable

Hi qlikviewforum

               When I tested your code I was able to fetch only "xlsx". Automattically it skips the "xlsm".So can you confirm once again,if still you have the problem

LOAD *,

      Filename() as File_Info

FROM

[Desktop\QV E books\Data\*.xlsx]

(ooxml, embedded labels, table is Sheet1);

-Jay

Not applicable

Hi Luis,

I've tried to add below script to skip the file, but why I got Script line error.

  1. IF RIGHT($(File),3) = 'xls' THEN


Regards,

Catherine