Smart Apps Pro

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

  1. Keep the same number of columns in every row.
  2. Don't add extra commas inside a value, unless you quote it.
  3. Keep the header row as the first line.
  4. Save with the same encoding, ideally UTF-8.
  5. 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.

Get Notepad+ Text Editor →

Notepad+ Text Editor app icon

Notepad+ Text Editor

A fast, advanced text editor for notes and code, with emoji support

Get the app

More about Notepad+ Text Editor