Click or drag to resize
[Columns] section
Print this page

The [Columns] section is required for handling files that use fixed-width format or have no headers.

This section lets you define column widths and/or logical names for each of the input columns (on a create or update) or the output columns (on a retrieve), based on their ordinal position.

This topic contains the following sections:

Usage

There are three situations in which you need to include a [Columns] section:

  • Importing data from a file that lacks a header row.
    • [Columns] defines the names of the columns in the input file.
    • In the [Template] section, set InputHeader = false.
  • Importing data from a file with fixed-width format.
    • [Columns] defines the widths of the columns in the input file.
  • Retrieving data to a file with fixed-width format.
    • [Columns] defines the names and widths of the columns in the output file.
    • In the [Template] section, set Format = FixedWidth.
Entries

Unlike other sections of the template file, entries in the Columns section do not consist of name value pairs. Instead, each entry is a comma-separated list of three values:

  1. The zero-offset column index
  2. The column name
  3. The column width (when the input or output file uses fixed-width columns and no delimiters)

Follow these guidelines when working with fixed-width files:

  • Always include the third value (column width).
  • Always include an entry for every column in the file, even if you are not using it.
  • For retrieves, include negative widths for output columns that should be right-aligned.
Example: Missing headers

This provides names for the columns in the input CSV file of an input template that has no header row:

[Columns]
0,ID,
1,Year,
2,Make,
3,Model,
4,VIN,

The result is the same as if the input file contained a header row containing these values:

ID, Year, Make, Model, VIN
Example: Fixed width

This provides names for the columns in a fixed-width input or output file:

[Columns]
0,ID,6
1,Time,15
2,Lat,10
3,Lon,10
4,Type,4
5,Card,16
6,Volume,5
7,Price,-5

If the Intent of the template is Retrieve, then all of the columns in the output file will be left-aligned, except for Price, which will appear right-aligned.