Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a number of .csv files which follow the same naming convention, but have different fields.
The format/fields I require are:
- SERIAL NUMBER
- VERSION
- DATE
- RADIO ID
Example of other files with same naming convention, but different fields:
- SERIAL NUMBER
- COST
- CLASS
- OTHER ID
Is there a way to load only those files with the required fields?
One possibility would be to set errormode = 0 before the load. The files without the correct fields would cause errors, but would be ignored.
May be like this
Table:
LOAD * From YOURTABLE .....;
LET A = FieldNumber('SERIAL NUMBER','Table')+FieldNumber('COST','Table')+FieldNumber('CLASS','Table')+FieldNumber('OTHER ID','Table');
If A <> 10 then
Drop Table Table;
Exit Script;
Endif;
..............
When adding a spreadsheet, use the Labels option equal to None, position it on the line where it starts:
For example:
TableSpreadsheet:
LOAD A as [Serial Number],
B as [Cost],
C as [Class],
D as [Other ID]
FROM
<Path of your Worksheet>
(ooxml, no labels, header is <Place on which line begins> lines, table is <Your Sheet>);
If you rename the labels you will have no problem loading, understand?