CSV Writer - Haufe-Lexware/haufe.no-frills-transformation GitHub Wiki
Use the following target definition to write CSV files:
<Target config="[configuration]">file://[path to csv file]</Target>Notes:
- The file name must end with
.csv, otherwise the CSV Writer will not react - 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 |
|---|---|---|
append |
false |
Pass true if you want to append to an existing file. This also means that the CSV Writer will not write any field headers (as they are assumed to exist) |
delim |
';' |
The delimiter used in the CSV file; normally ',' or ','. |
encoding |
UTF-8 |
The encoding to use for the CSV file; supported values are any valid encoding, like UTF-8, UTF-16 or ISO-8859-1. |
headers |
true |
Pass false to prevent the CSV Writer from writing the field headers. If not set, this is overridden by the append parameter (see above) |
utf8bom |
true |
Determines whether the CSV Writer should output the UTF-8 Byte Order Mark or not. Only applies if encoding is UTF-8. |
sort |
not set | Defines the sort order of the output; must be a list of output fields. Note: This makes the CSV writer to keep the entire output in memory, thus is not suitable for very large data sets. If sort is not set, the order will be the same as the source. |
<Target config="delim=';' encoding='iso-8859-1'">file://C:\Temp\my_output.csv</Target>This outputs to the file C:\Temp\my_output.csv, using ; as a field delimiter, and using the encoding iso-8859-1 (Western European ANSI code page).
The same escaping rules as stated in the CSV Reader documentation are applied when writing CSV files. Please confer with the CSV Reader page for more information.