Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I have a folder in which i have two source files (xslx files) and i want to load this files. note that:
- This files are named differently each time,
- This files have different structure, and i don't upload all the columns( i don't do load * )
So how can i load data from this excel files ? without ODBC connection ?
Thank you very much for your help!
Hi
You can use Error variables to handle errors in script.
For example your script may look like this:
SET ErrorMode=0; // Disable all errors
/* Try to load first format from all files in dirctory */
Table1:
LOAD
Field1,
Field2,
Field3
FROM [lib://YourPath\*.xlsx]
(ooxml, embedded labels, table is Sheet1);
/* Try to load second format from all files in dirctory */
Table2:
LOAD
Field4,
Field5,
Field6
FROM [lib://YourPath\*.xlsx]
(ooxml, embedded labels, table is Sheet1);
SET ErrorMode=1; // Finally set error mode to 1
Note the * character in the FROM expression! it will load all files from the directory by mask *.xlsx