How to open a .csv file

A spreadsheet opens it, a text editor shows you what is really in it, and the difference matters more than it sounds.

What it is

A `.csv` is rows of text with a separator between the fields — usually a comma, sometimes a semicolon or a tab. There are no types, no formulas and no formatting: every value is a string, and anything that looks like a date or a number is your software guessing.

Opening it

Double-clicking opens it in Excel or Numbers on most machines, and in LibreOffice Calc if that is installed. Google Sheets imports one through File, Import.

Opening it in a text editor first is worth the ten seconds: it shows the real separator, whether the first row is a header, and whether the fields are quoted — three things a spreadsheet decides for you silently.

When the columns come out wrong

Everything landing in one column means the separator your file uses is not the one your spreadsheet expected. In Excel, use Data, From Text/CSV rather than double-clicking, and set the delimiter yourself.

Accented characters coming out as nonsense is an encoding mismatch: the file is UTF-8 and the program assumed something else. The same import dialogue lets you say so.

Leading zeros disappearing from postcodes or part numbers is not recoverable after the fact — the spreadsheet converted the value to a number on open. Import the column as text instead.

Putting it in a document

Pasting a spreadsheet range into a document gives you either a picture of a table or a mess, depending on where you paste it. Converting the file to a Markdown table gives you rows that survive a copy, a diff and a pull request.