-
-
Notifications
You must be signed in to change notification settings - Fork 571
CsvImport
Paweł Salawa edited this page Jan 25, 2024
·
2 revisions
Imports data from CSV files.
If the file has a column names in first line, then appropriate option should be checked in the importing options. Column names passed in first line can be used as columna names for new table when importing data into inexisting table (in which case table is automatically created). When importing to existing table, column names from first line are ignored.
The plugin also supports custom separators to use instead of a comma.
Example CSV data:
Id,Name
1,John
2,Sandra
3,Kate
Description of options that can be defined for the plugin, when executing import()
:
Option | Valid values | Description |
---|---|---|
CsvImport.FirstRowAsColumns |
true / false
|
Defines whether to treat first line from CSV input file as column names (for existing output table it just skips the first line from file, but for inexisting output table this line is used for new table column names) |
CsvImport.Separator | 0-4 |
Separator character for fields in lines. 0 is a comma , ), 1 is a semicolon (; ), 2 is a tab ( ), 3 is a whitespace ( ), 4 is a custom character defined by CsvImport.CustomSeparator option. |
CsvImport.CustomSeparator | Any character | A custom separator character for fields in lines. Will be used only if CsvImport.Separator is set to 4. |
CsvImport.NullValues |
true / false
|
Whether to treat values defined by option CsvImport.NullValueString as NULL. If false, then all values from CSV input file will be treated literally (so no NULLs). |
CsvImport.NullValueString | Any sequence of characters | A value which - when encountered in input CSV file - will considered to be a NULL value and that's how the plugin will import it into a table. |