CSV and Text Input
For a runnable .NET example, see Import CSV data. The shared field-handling rules also apply.
If the CSV source is already defined in your layout, see Choose a Configured CSV File at Runtime to change its filename while keeping the stored import settings.
TFORMer can import CSV (comma-separated values) and other delimiter-separated text files. Configure the column separator and optional text qualifier; input files may use LF or CRLF line endings. A text qualifier encloses one value, so that value may contain the column separator.
File Format
Text files must be structured as follows:
-
Header row: The first line lists the column names, which are the data-field names.
-
Data rows: The following lines contain the data-field values, with one record per line.
DataFieldName1;DataFieldName2;..;DataFieldNameN
Value;Value;..;Value
Value;Value;..;Value
:
Further Data Records
:
Example:
ArticleName;ArticleNo;ArticlePrice
Chair;558963;110
Desk;778920;150
Monitor;775116;236
Panel;544593;40
Coffee Machine;549896;30
Printer;458862;100
Fax;445866;115
Phone;458932;50
The following tables list the configurable column separators and text qualifiers, and the supported line endings.
Valid Column Separators
| Character | Description | Example |
|---|---|---|
| TAB | Tab character (0x09) |
Value<TAB>Value<TAB>Value |
; |
Semicolon (0x3B) |
Value;Value;Value |
, |
Comma (0x2C) |
Value,Value,Value |
| Space | Space character (0x20) |
Value Value Value |
| Other | Any other single character | Value#Value#Value |
<TAB> represents one tab character (0x09); it is explanatory notation, not literal file content.
Supported Line Endings
| Character | Description | Typical origin |
|---|---|---|
| LF | Line feed (0x0A) |
Linux/Unix-like text files |
| CRLF | Carriage return followed by line feed (0x0D 0x0A) |
Windows text files |
The origins are common file conventions, not platform-support promises.
Valid Text Qualifiers
| Character | Description | Example |
|---|---|---|
" |
Double quote (0x22) |
"Value" |
' |
Single quote (0x27) |
'Value' |
| Other | Any other single character | +Value+ |
| None | No qualifier | Value |
To disable qualifiers, pass NUL ('\0') in .NET, Java or the native C API. In COM, set JobDataCsv.Qualifier to an empty string.