Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Can anyone please let me know how to write a for loop statement for loading data several xml files?This XML files are located in a particular folder.
Instead of loading one by one felt it would be better to load them at one go.
Any help or guidelines in this regard is highly appreciated.
Hi,
This is the sample script to load the files from a folder.
// list all QV related files on disk
SUB DoDir (Root)
FOR Each Ext in 'qvw', 'qva', 'qvo', 'qvs'
FOR Each File in filelist (Root&' \*.' &Ext)
LOAD
'$(File)' as Name,
FileSize( '$(File)' ) as Size,
FileTime( '$(File)' ) as FileTime
autogenerate 1;
NEXT File
NEXT Ext
FOR Each Dir in dirlist (Root&' \*' )
call DoDir (Dir)
NEXT Dir
ENDSUB
CALL DoDir ('C:')
I am not giving you proper solution, cause i want you to try by your own logic.
Regards,
Kaushik Solanki
Hi kaushik,
I believe that the example you shared is very good one. I learned new things with it.
Regards,
Vasim
Hi,
Two examples I have tested with Excel files:
Example 1:
for each file in FileList('*.xlsx')
Temp_Table1:
load A as ID2,
B as Number2
FROM $(file)
(ooxml, no labels, table is Feuil1);
next
Example 2 even simpler:
Temp_Table1:
load A as ID2,
B as Number2
FROM *.xlsx
(ooxml, no labels, table is Feuil1);
Fabrice