The following node is available in the Open Source KNIME predictive analytics and data mining platform version 2.7.1. Discover over 1000 other nodes, as well as enterprise functionality at
http://knime.com.
CSV Writer
This node writes out the datatable coming through its input port
into a file. The node provides many options to customize the output
format (see below). But there is no checking done on the settings, so
it is possible to write out the data in a format that makes it
impossible to read it in again (e. g. if you specify no data separator).
Dialog Options
- Output file location
- Enter a valid file name.
You can also choose a previously selected file from the drop-down list,
or select a file from the "Browse..." dialog.
- 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 LOOPER node 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.
- Compress output file (gzip)
- Compress the output file
in gzip format. If enabled, you will not be able to append to an
existing file.
- If file 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) and Abort
will issue an error during the node's execution (to prevent
unintentional overwrite).
- Data Separator
- In the Advanced tab, you can specify the
character(s) that will be written out between the data items. You can
use "\t" for a tab or "\n" for a new line character (and must use
"\\" for a backslash) in any character sequence.
- Missing Value Pattern
- In the Advanced tab, enter a pattern
that will be written out for missing data values. Note, the missing
value pattern will never be put into quotes (see below).
- Quote Pattern
- In the Quotes tab, you can enter a left
and right quotation mark pattern. Also, select a mode, which determines
when quotation marks should be placed around the data item. When quotes
are used (in every mode other than "never") you must also specify a
replacement pattern for the right quote. If it appears in the data
item, it must be replaced (so it won't be confused with the actual
closing quote).
- Quote Mode: always
- Every data item written out is
placed between quotation marks. (The missing value pattern is not
quoted though.)
- Quote Mode: 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 Mode: non-numerical 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 Mode: 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.
- 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 begin
and comment end pattern.
- Header Content: the current creation time
- If checked, a
comment line with the current time and date is added.
- Header Content: the user account name
- If checked, the login
name of the user that created the file (probably you!) is inserted.
- Header Content: the input table name
- If checked, a comment
line is added showing the name of the table the data was read from.
- Header Content: this text
- If you check this, you can enter
any text, that will be added then to the comment header. Use "\n" to
start a new line, and "\t" to insert a tab character (and "\\" to
produce a backslash).
- Comment Pattern
-
If you have checked at least one of the content options, you must
provide comment begin and end patterns that are placed around the
comment header then. If you omit the end pattern the begin pattern
is placed at the beginning of each comment line (assuming single
line comments, in contrast to block comment if you specify both
patterns).
- Decimal Separator
-
In the tab "decimal separator" you can enter a character that is used as
decimal separator for floating point numbers. It replaces the default
character '.' then.
Ports
Input Ports
0 |
The Datatable to write out. |
This node is contained in KNIME Base Nodes
provided by KNIME GmbH, Konstanz, Germany.