CSV Files: Simple Tables in Plain Text
What CSV files are, how they are structured, how to edit them safely in a text editor and the common mistakes to avoid.
A CSV file stores a table as plain text. It's used for spreadsheets, exported data, contact lists and more. Because it's just text, you can open and edit it in a simple editor.
What CSV means
CSV stands for comma-separated values. Each line is a row, and commas separate the columns.
name,city,age
Ana,Lisbon,34
Ben,Leeds,29
Chen,Taipei,41
Opened in a spreadsheet, this shows as a table with three columns and three rows plus a header.
Why people use it
- It's universal. Almost every spreadsheet and database program can read and write CSV.
- It's small and simple.
- It's easy to edit by hand, when needed.
- It works for moving data between programs.
Editing safely in a text editor
- Keep the same number of columns in every row.
- Don't add extra commas inside a value, unless you quote it.
- Keep the header row as the first line.
- Save with the same encoding, ideally UTF-8.
- Keep the .csv extension.
Values that contain commas
If a value itself contains a comma, wrap it in double quotes:
name,address
Ana,"12 High Street, Lisbon"
Without the quotes, the comma would split the address into two columns.
Quotes inside a value
If a value contains a double quote, double it:
quote
"She said ""hello"""
Other separators
Some regions use semicolons instead of commas, because commas are used as decimal marks. Files that use tabs are called TSV. If your file opens in a single column in a spreadsheet, the separator may be different.
Common mistakes
| Mistake | Result |
|---|---|
| Missing comma | values shift into the wrong column |
| Extra comma | an extra column appears |
| Unquoted comma in a value | the row breaks |
| Wrong encoding | accents and symbols look strange |
| Saving in a spreadsheet's own format | it is no longer plain CSV |
Best uses
- Small lists such as contacts, budgets or reading lists.
- Quick fixes, such as correcting a typo before importing the file.
Keep a copy
Before editing an important CSV file, make a copy, so you can go back if something breaks.
Notepad+ Text Editor
A fast, advanced text editor for notes and code, with emoji support
More about Notepad+ Text Editor
An Idea Inbox: Capturing Thoughts Before They Vanish
A low-effort system for catching ideas, tasks and half-formed thoughts in a single text file, and reviewing them later.
Read article →Backing Up Your Notes: Simple Habits That Protect Your Writing
Why every note collection needs a backup, and easy, practical ways to copy your text files somewhere safe.
Read article →Naming Your Files So You Can Find Them Again
Practical file-naming habits for text notes, including dates, keywords and characters to avoid.
Read article →Recipe Notes in Plain Text: A Simple System for Cooks
How to keep your own recipes and kitchen notes in a plain text file, with a template and tips for tweaks and scaling.
Read article →