Why CSV needs a parser
CSV looks trivial until real data arrives. Three rules are the whole reason a scanner is required instead of splitting on the delimiter:
- A field wrapped in quotes may contain the delimiter itself
- A quoted field may contain a newline, so one record can span several lines
- Two quotes inside a quoted field stand for one literal quote
Any export containing an address, a company name or free text will hit at least the first of these.
Types are a decision, not a detail
Converting a numeric string to a number is convenient. Doing it to 007 is data
loss, and it happens silently to identifiers, postcodes, phone numbers and
version strings. That is why the toggle exists and why it starts off.
When it is on, leading zeros are protected specifically: a value that looks numeric but starts with a zero stays a string.
Header handling
With a header row, each record becomes an object keyed by column name. An empty
header cell would produce an empty key, so those become column_2 and so on
rather than colliding with each other.
Questions
Why is type conversion off by default?+
Because it destroys data. A postcode of 01234, a phone number, an order reference of 007 — all become numbers with the leading zero gone, silently. Turn it on when you know your columns are genuinely numeric; leave it off for anything that identifies something.
Does it handle commas inside quoted fields?+
Yes, and newlines inside quoted fields, and doubled quotes meaning a literal quote. That is what separates a real CSV parser from splitting on commas, and why a spreadsheet export with an address column breaks naive tools.
My file came from Excel and the first column name looks wrong.+
Excel writes a UTF-8 byte order mark at the start of the file, which becomes an invisible character on the first header. It is stripped here before parsing, so the first key comes out clean.
What if my file uses semicolons?+
Pick the delimiter in the toolbar. Semicolon-separated files are the norm anywhere the comma is a decimal separator, which is most of continental Europe and the CIS.