Writer Directives

The suffixes shown are prefixed by the current <WriterKeyword> in a mapping file. By default, the <WriterKeyword> for the CSV reader is CSV.

DATASET

Required/Optional: Required

This is the name of a folder containing one or more CSV files. The default extension for CSV files is .csv. To write gzipped files, use .csv.gz as the destination file extension.

An example of the DATASET keyword in use is:

CSV_DATASET /usr/data/csv/output

Workbench Parameter: Destination Comma Separated Value (CSV) Folder

DEF

Required/Optional: Required

Defines a CSV file. The definition contains the file’s base name without any of the extensions, followed by the definitions of the attributes. There may be many DEF lines, one for each file to be written.

The syntax of a CSV DEF line is:

<WriterKeyword>_DEF <baseName>	\
[<attrName> <attrType>]+

The attribute types supported by the CSV writer are the same as those listed in the Reader Keywords DEF section. The following DEF line directives are supported by the CSV writer:

DEF Line Directives

Value

Required/Optional

CSV_FIELD_NAMES

<yes|no>

See FIELD_NAMES below for details.

Optional

CSV_SEPARATOR

(<separator>)

See SEPARATOR below for details.

Optional

CSV_EXTENSION

<extension>

See EXTENSION below for details.

Optional

CSV_ENCODING

<encoding>

See ENCODING for details.

Optional

CSV_END_OF_LINE

<encoding>

See END_OF_LINE for details.

Optional

Each of these directives has the same meaning as the global CSV writer keyword with the same suffix. Any value specified on a DEF line will override values defined for equivalent global directives, as they apply to the table being defined.

FIELD_NAMES

Required/Optional: Optional

If the field or column names of the CSV table are specified as the first row of the file, set this value to yes and the names will be written to the file. Otherwise, none of the column names will be written to file.

Values: <yes|no>

Default: no

Workbench Parameter: Output field names on first line

WRITE_SCHEMA_FILE

Required/Optional: Optional

Write out a schema configuration file, containing field names and types, along with the output CSV file(s).

Values: <yes|no>

Default: no

Workbench Parameter: Write Schema Configuration File

PREPEND_SCHEMA_FILE

Required/Optional: Optional

If this directive is yes and there exists a schema configuration file in the output directory, new information is prepended to the existing schema.ini file. ArcGIS only takes into account the first config entry encountered for each CSV file, so the latest entries should be at the top of the file. If set to no, any existing schema.ini files are overwritten.

If WRITE_SCHEMA_FILE directive is set to no, this value is ignored.

Values: <yes|no|unused>

Default: unused

Workbench Parameter: Prepend to Existing Schema Configuration File

SEPARATOR

Required/Optional: Optional

A special field is listed to identify the separator used to divide the fields in the file. By default, a comma is used; however, different one-character separators can also be specified. Tab character separators are indicated by a backslash (\) followed by a “t”; for example:

CSV_SEPARATOR (\t)

Note: There must be a space between CSV_SEPARATOR and (<separator>). The begin and end parentheses are optional.

Values: (<separator>)

Workbench Parameter: Separator Character

EXTENSION

Required/Optional: Optional

This specifies the file extension to be written. The default is .csv.

Note: Include the period in front of the extension name. .csv.gz extension will output gzipped files.

Values: <extension>

Workbench Parameter: Extension

QUOTE_OUTPUT

Required/Optional: Optional

This specifies whether the fields written to the CSV file are quoted. If set to yes, then every field, including field names, will be quoted. If set to no, no fields will be quoted. If set to if_needed, fields will be quoted if they contain one or more delimiter or quote characters.

Note: If set to no, and the field contains an embedded delimiter the delimiter character in that field will be replaced by the space character. If space is already the delimiter the pipe character will be used instead. Generally using the if_needed value would be a better choice in this case.
Note: The meaning of a yes value differs slightly between the CSV format writer and the CSV mode of the Relational Table writer.

Values: yes | no | if_needed

Workbench Parameter: Quote Output Values

QUOTE_FIELD_NAMES

Required/Optional: Optional

This specifies whether the field names written on the first row of the CSV file are quoted. If set to yes, then field names will be quoted. If set to no, field names will not be quoted.

Values: yes | no

Default: no

Workbench Parameter: Quote Field Names

APPEND

Required/Optional: Optional

This specifies whether rows will be appended to existing files if a matching CSV file was found in the destination folder.

Values: yes | no

Default: no

Workbench Parameter: Append to File

ENCODING

Required/Optional: Optional

This specifies the file encoding to use when writing.

Values: <encoding>

Workbench Parameter: Character Encoding

Encodings

UTF-8

UTF-16
UTF-16LE
UTF-16BE
UTF-32
UTF-32LE
UTF-32BE
CP737
CP775
CP850
CP852
CP855
CP857
CP860
CP861
CP862
CP863
CP864
CP865
CP866
CP869
CP874
CP932
CP936
CP950
CP1250
CP1251
CP1252
CP1253
CP1254
CP1255
CP1256
CP1257
CP1258
ISO8859-1
ISO8859-2
ISO8859-3
ISO8859-4
ISO8859-5
ISO8859-6
ISO8859-7
ISO8859-8
ISO8859-9
ISO8859-13
ISO8859-15
Windows-949
Windows-10000
Windows-10006
Windows-10007
Windows-10029

WRITE_UTF8_BOM

Required/Optional

Optional

This specifies whether the byte order mark for UTF-8 encoded file should be written at the beginning. This option only has effect when the encoding is set to UTF-8.

Values: yes | no

Default: yes

END_OF_LINE

Required/Optional: Optional

This specifies the end of line character to use when writing.

Values: Macintosh | Windows | Unix | System

Default: System

Workbench Parameter: Line Termination