Skip to main content

CSV Input

The CLI reads CSV files with the mapping you provide through YAML or --col-* options.

Header Mode

By default, the CLI expects a header row and mappings use header names:

columns:
vatId: "VatId"
name: "CompanyName"

Example CSV:

VatId;CompanyName;Street;PostalCode;City
DE123456789;Example GmbH;Main Street 1;80331;Munich

The CLI validates that every mapped column exists in the header.

No-Header Mode

Use --no-header when the CSV has no header row:

optimus check customers.csv --no-header --col-vat-id 1 --col-name 2 --standard

In no-header mode, mapped columns must be 1-based indexes:

columns:
vatId: "1"
name: "2"

Run --dry-run after changing no-header mappings. The preview shows the first 5 checkable rows that would be sent to the API, so you can confirm each index points to the expected value.

Delimiters

Set the input delimiter explicitly when needed:

optimus check customers.csv --map mapping.yml --in-delimiter ";"

Or in YAML:

input:
delimiter: ";"

When no delimiter is configured by CLI or YAML, the reader can auto-detect it.

Encodings

Supported input encodings are:

  • utf-8
  • windows-1252
  • iso-8859-1

Set the encoding with:

optimus check customers.csv --map mapping.yml --standard --in-encoding windows-1252

Or:

input:
encoding: windows-1252

Skipping Rows Before The Header

Use --skip-rows when the file has metadata rows before the header:

optimus check customers.csv --map mapping.yml --standard --skip-rows 2

YAML equivalent:

input:
skipRows: 2

Skipped Records

By default, rows with empty VAT IDs are skipped:

filter:
skipEmptyVatId: true

You can also skip VAT IDs that match a regular expression:

filter:
skipPattern: "^TEST"

Skipped rows are still written to the result CSV with vat_id_status set to SKIPPED.

Passthrough Columns

Use customColumns for local values you want to keep in the result CSV:

customColumns:
customer_number: "CustomerNumber"

Passthrough values are read before row skip filters, so skipped rows can still include your local identifiers in the result CSV.