-
Notifications
You must be signed in to change notification settings - Fork 1
CSV Reader
Use the following source definition to read CSV files:
<Source config="[configuration]">file://[path to csv file]</Source>
Notes:
- The file name must end with
.csv
, otherwise the CSV Reader will not pick it up - The prefix must be
file://
; other location types are currently not supported.
The config
attribute may contain configuration settings of the CSV Reader using the following notation: parameter=value
. The following parameters are supported:
Parameter | Default | Description |
---|---|---|
delim |
';' |
The delimiter used in the CSV file; normally ',' or ',' . |
encoding |
tries to deduce from input file | The encoding to use for the CSV file; supported values are any valid encoding, like UTF-8 or ISO-8859-1 . |
multiline |
true |
Determines whether the CSV reader supports multiline content or not. Normally you don't need to change this. |
<Source config="delim=';'">file://C:\Temp\my_table.csv</Source>
This instanciates the CSV reader for the file C:\Temp\my_table.csv
, assuming that it uses the ;
character as a field delimiter.
The CSV Reader assumes that the double quote is used to "escape" field content which contains the delimiter. If you need double quotes inside the field content, use a double double quote in the CSV file. This will be read as a single double quote.
Example: The file uses the delimiter ,
, and a field contains a comma inside:
-
Oh my, this is awesome
must look like this:"Oh my, this is awesome"
. -
Oh my, he was "ironic"
must look like this:"Oh my, he was ""ironic"""
Example CSV input file (using ;
as a delimiter):
Key;Text
001;Random text without problems
002;"Text containing a ; for some reason"
003;"I like ""double quotes"" in CSV files"
004;"This is a
multiline text
which does not pose problems."
005;Last line in file
Note: For multiline field content, the content must mandatorily be wrapped in double quotes; otherwise the CSV reader will not be able to recognize the content belongs together.