Skip to content

What a CSV file is, and why Excel keeps breaking it

Blog / Published 

A CSV file is plain text where each line is a record and the fields inside it are separated by a delimiter, usually a comma. It is the most portable way to move a table between programs, which is why it shows up in bank exports, CRM dumps and analytics downloads. The format is simple. Most of the problems come from what applications do with it after it is opened.

The shape of a CSV file

The first line is often a header row with column names, and every line after it is one row. A value that contains the delimiter, a line break or a double quote is wrapped in double quotes, and a quote inside a quoted value is doubled. The format is described in RFC 4180, although many real files bend it.

A tiny example with three columns:

id,name,city
1,"Novak, Jan",Brno
2,Eva,Praha

Why Excel breaks it

Excel does not read the file the way a parser does. It opens it with your computer's regional settings, and three things commonly go wrong:

The usual fix is to import the file with explicit settings and mark the ID column as text, instead of double-clicking it.

Converting without a spreadsheet

If the next step is code, a CSV is often easier to handle as JSON. The CSV to JSON converter reads the header row and produces one object per line, and it runs entirely in your browser. Going the other way, the JSON to CSV converter flattens an array of objects into rows, which is the format most import screens expect.

Practical checks before you import

Written by Ján Turský

Creator of TextArray — building free, privacy-first tools that run entirely in your browser.