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
Drafting Emails in a Text Editor First
Why drafting important emails in a separate text editor prevents accidental sends, improves clarity and helps you write calmer messages.
Read article →Keeping a CV in Plain Text for Easy Updates
Maintain a master CV in a plain-text file so you can update it anywhere, tailor it quickly and paste it cleanly into online application forms.
Read article →Keeping a Work Diary for Performance Reviews
Record your achievements, feedback and challenges throughout the year in a simple text file, so performance reviews and promotions are easier to prepare.
Read article →Outlining a Novel in a Text Editor
Use a plain-text outline to plan characters, chapters and plot for a novel — flexible, searchable and easy to rearrange.
Read article →