CSV Output
Write rows into a CSV file
Processing
For every input row, the step writes a record into a CSV file.
Settings
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Filesystem |
dict |
The filesystem to use. If the filesystem is Evaluated for each input row |
||||||||
File |
string |
The CSV file to write to Evaluated for each input row |
||||||||
Charset |
string |
The character encoding of the file Evaluated for each new file |
||||||||
Compression |
string |
Compresses the file using the selected algorithm.
Evaluated for each new file |
||||||||
Separator |
string |
Character separating CSV fields Commonly this is a comma, semicolon or tab character Evaluated for each new file |
||||||||
Enclosed by |
string |
Character optionally enclosing CSV fields Commonly this is a singlequote or doublequote character Evaluated for each new file |
||||||||
Line Endings |
string |
The line endings to use. Typical choices are:
Evaluated for each new file |
||||||||
Header Line |
boolean |
If checked, a header line containing field names is written as the first line of the file. If not checked, only data lines are written. Evaluated for each new file |
||||||||
When file exists |
string |
When the CSV file already exists:
Evaluated for each new file |
||||||||
Columns |
How output file structure is established:
Specified at design time |
Columns - fixed
Defines data written to the output file.
Evaluated for each input row
- Name
- Name of the field.
- Value
- Value to write to ouput.
- Formatter
- Optional function transforming the value to the string written.
- Use
nil
to just cast the value to string. - Use one of the formatter functions available in the morph context menu to convert to string.
- Supply a function
(x) -> string
that transforms the field value to a string using custom rules.
- Use
Columns - data driven
When output columns are data driven, the step determines file structure at runtime.
Name | Type | Description |
---|---|---|
Column Names |
list |
A list defining the columns written to file. Eeach entry can be one of:
To specify three output columns you would supply a definition such as:
The following is equivalent:
Evaluated for each new file |
Column Values |
list or dict |
A list or dict defining the data to write to file. If the data structure is a list, the value for each column is extracted in order. If the data structure is a dict, the values for columns are extracted by using column names as keys. For example, consider the following column definition:
We can supply column values as a list:
We can also supply column values as a dict:
Evaluated for each input row |
Results
This step does not provide any results