0 ×

CSV Writer

StreamableKNIME Base Nodes version 4.3.1.v202101261649 by KNIME AG, Zurich, Switzerland

This node supports the path flow variable. For further information about file handling in general see the File Handling Guide.

This node writes out the input data table into a file or to a remote location denoted by an URL. The input data table must contain only string or numerical columns. Other column types are not supported.

Options

Settings

General settings regarding the output file location and formats.

Write to
Select a file system in which you want to store the file. There are four default file system options to choose from:
  • Local File System: Allows you to select a location in your local system.
  • Mountpoint: Allows you to write to a mountpoint. When selected, a new drop-down menu appears to choose the mountpoint. Unconnected mountpoints are greyed out but can still be selected (note that browsing is disabled in this case). Go to the KNIME Explorer and connect to the mountpoint to enable browsing. A mountpoint is displayed in red if it was previously selected but is no longer available. You won't be able to save the dialog as long as you don't select a valid i.e. known mountpoint.
  • Relative to: Allows you to choose whether to resolve the path relative to the current mountpoint, current workflow or the current workflow's data area. When selected a new drop-down menu appears to choose which of the three options to use.
  • Custom/KNIME URL: Allows to specify a URL (e.g. file://, http:// or knime:// protocol). When selected, a spinner appears that allows you to specify the desired connection and write timeout in milliseconds. In case it takes longer to connect to the host / write the file, the node fails to execute. Browsing is disabled for this option.
It is possible to use other file systems with this node. Therefore, you have to enable the file system connection input port of this node by clicking the ... in the bottom left corner of the node's icon and choose Add File System Connection port .
Afterwards, you can simply connect the desired connector node to this node. The file system connection will then be shown in the drop-down menu. It is greyed out if the file system is not connected in which case you have to (re)execute the connector node first. Note: The default file systems listed above can't be selected if a file system is provided via the input port.
File/URL
Enter a URL when writing to Custom/KNIME URL, otherwise enter a path to a file. The required syntax of a path depends on the chosen file system, such as "C:\path\to\file" (Local File System on Windows) or "/path/to/file" (Local File System on Linux/MacOS and Mountpoint). For file systems connected via input port, the node description of the respective connector node describes the required path format. You can also choose a previously selected file from the drop-down list, or select a location from the "Browse..." dialog. Note that browsing is disabled in some cases:
  • Custom/KNIME URL: Browsing is always disabled.
  • Mountpoint: Browsing is disabled if the selected mountpoint isn't connected. Go to the KNIME Explorer and connect to the mountpoint to enable browsing.
  • File systems provided via input port: Browsing is disabled if the connector node hasn't been executed since the workflow has been opened. (Re)execute the connector node to enable browsing.
The location can be exposed as or automatically set via a path flow variable.
Create missing folders
Select if the folders of the selected output location should be created if they do not already exist. If this option is unchecked, the node will fail if a folder does not exist.
If exists
Specify the behavior of the node in case the output file already exists.
  • Overwrite: Will replace any existing file.
  • Append: Will append the input table to the end of the file (possibly skipping the column header)
  • Fail: Will issue an error during the node's execution (to prevent unintentional overwrite).
Column delimiter
The character string delimiting columns. Use '\t' for tab character.
Row delimiter
Select the line break variation you want to use as row delimiter while writing the CSV file.
  • System Default: use the line break of the system on which the node is executed.
  • Linux/Unix Line Break: use LF (line feed) as in Linux/Unix systems.
  • Windows Line Break: use CR+LF (a carriage return followed by a line feed) as in Windows/Dos systems.
  • Mac OS9 Line Break: use CR (a carriage return only) as in old MacOS (before MacOS 9) systems.
Quote char
The quote character used to enclose values with. See the advanced tab to specify what kind of values should be enclosed within quotes.
Quote escape char
The character is used for escaping quotes inside an already quoted value.
Write column header
If checked, the column names will be written out in the first line of the output file.
Don't write column headers if file exists
If checked, the column headers will not be written when the output is appended to the already existing output file. This is particularly useful when the CSV Writer is used in a loop to report results. This option is ignored when the column header is not written anyway or the file append option is unchecked (see below).
Write row ID
If checked, the row IDs will be added to the output, as first item in each line.

Advanced Settings

In the Advanced tab, you can specify when to quote values and how to handle the formatting of numeric values before writing them to file. There is also an option to write files compressed with GZip compression.

Quote values: always
Every data item written out is placed between quotation marks. (The missing value pattern is not quoted though.)
Quote values: if needed
Quotes are only placed around a data item that contains the data separator (specified in the Advanced tab) or if it equals the missing value pattern. The right quote pattern will be replaced if it appears in a quoted data item.
Quote values: strings only
Integer and floating point numbers are not quoted, all other data items are. (Selecting the decimal point as data separator will lead to an output that can't be read in again.) The right quote is replaced in quoted items.
Quote values: never
No data item is placed between quotation marks. You should specify a replacement pattern for the data separator, if it occurs in the data item.
Replace column separator with
Specify a replacement for the value used as a column separator. Used only if the never option is selected for Quote values.
Decimal Separator
Here you can enter a character that is used as decimal separator for floating point numbers. It replaces the default character '.' then.
Use scientific format for very large and very small values
Check this if you want very large and very small floating point numbers to be written in scientific notation (e.g., 1.0E9 instead of 1,000,000,000).
Append .0 suffix for decimal values without fractions
Check this if you want to write every decimal value with .0 suffix even though the value doesn't contain any fractional part. (e.g., the value 12 will be written as 12.0 if it is coming from a decimal column). Use with caution as this could lead to unnecessary increase of the file size. This doesn't affect the way to write values from integer columns. The option is ignored if we are using a scientific format.
Replace missing value with
Set this option to replace missing values from the input table with specific text when writing.
Compress output file (gzip)
Check this if you want to compress the output file using gzip compression.

Comment Header

In the Comment Header tab you can add a comment header to the beginning of the output. Either specify your own comment line(s) or choose from the predefined items. If you check one of the options you must also enter a comment line marker.

the user (login) name
If checked, the login name of the user that created the file (probably you!) is inserted.
the current execution time
If checked, a comment line with the current execution time and date is added.
the input table name
If checked, a comment line is added showing the name of the table the data was read from.
the following text
If you check this, you can enter any free text, that will be added then to the comment header.
Comment Line Marker
If you have checked at least one of the content options, you must provide a comment line marker that is used as a prefix for each comment line.
Comment Indentation
If you have checked at least one of the content options, you can specify an indentation string, i.e., a prefix for every comment line.

Encoding

File Encoding
To write a CSV file with a different encoding, you can select a character set in this tab (UTF-8, UTF-16, etc.), or specify any other encoding supported by your Java VM. The default value uses the default encoding of the Java VM, which may depend on the locale or the Java property "file.encoding"

Input Ports

Icon
The data table to write out.

Best Friends (Incoming)

Best Friends (Outgoing)

Workflows

Installation

To use this node in KNIME, install KNIME Base nodes from the following update site:

KNIME 4.3

A zipped version of the software site can be downloaded here.

You don't know what to do with this link? Read our NodePit Product and Node Installation Guide that explains you in detail how to install nodes to your KNIME Analytics Platform.

Wait a sec! You want to explore and install nodes even faster? We highly recommend our NodePit for KNIME extension for your KNIME Analytics Platform. Browse NodePit from within KNIME, install nodes with just one click and share your workflows with NodePit Space.

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.