CSV is a plain-text way to store data in rows and columns, readable by almost any program
CSV stands for "comma-separated values." It is a file format that stores information in a table structure — rows and columns — using only plain text and commas as dividers. A CSV file looks like a spreadsheet when you open it in Excel or Google Sheets, but underneath it is just text with commas marking where each column ends and the next one begins.
The reason CSV exists is simple: it works everywhere. A spreadsheet program like Excel can read it. A database can read it. A text editor can read it. A program written in 1995 and a program written last month can both open the same CSV file without any conversion. This makes CSV the standard format for moving data between different programs, especially when organizations need to share information with each other.
You encounter CSV files most often when you download data from a website, export records from one program to use in another, or receive a file from a government agency or business. The file usually has a name ending in .csv, like tax_records.csv or voter_registration.csv.
Key Takeaways
- CSV files store data in rows and columns using only commas and line breaks, making them readable by nearly any program.
- The first row usually contains column headers — the names of what each column contains — followed by data rows below.
- You can open a CSV file in Excel, Google Sheets, a text editor, or most data programs without installing special software.
- CSV format is plain text, so it does not preserve formatting like colors, bold text, or formulas the way Excel files do.
How a CSV file is structured
A CSV file is organized in rows and columns, just like a spreadsheet. The first row typically contains headers — the names of each column. Every row after that contains one record of data, with values separated by commas.
Here is a simple example of what a CSV file looks like when you open it in a text editor:
Name,Age,City,Phone Sarah Johnson,34,Portland,503-555-0142 Marcus Chen,28,Seattle,206-555-0189 Elena Rodriguez,41,Denver,720-555-0156
When you open this same file in Excel or Google Sheets, it automatically recognizes the commas and displays it as a proper table with four columns (Name, Age, City, Phone) and three rows of data. The program does the work of converting the comma-separated text into columns for you.
If a value itself contains a comma — for example, a business name like "Smith, Johnson & Associates" — the entire value is wrapped in quotation marks so the program knows not to treat that comma as a column divider. The file would show "Smith, Johnson & Associates",50,Boston,617-555-0123 and the program would correctly place the entire business name in one column.
Why organizations use CSV instead of other formats
CSV is the default format for sharing data because it solves a real problem: compatibility. If a government agency sends you data in a proprietary Excel file format (.xlsx), you need Excel or a compatible program to open it. If they send it as CSV, you can open it in Excel, Google Sheets, LibreOffice, a text editor, or paste it into almost any database or web form.
CSV is also extremely small. A CSV file containing thousands of records takes up far less disk space than the same data in an Excel file, because it contains only the raw data and text — no formatting, no hidden sheets, no formulas. This matters when organizations are transferring large datasets or when storage space is limited.
Another reason is that CSV is a standard that has not changed in decades. A CSV file created in 1990 opens identically in 2024. Proprietary formats change with new software versions, sometimes making old files difficult to open. CSV's simplicity means it will remain readable indefinitely.
Opening and editing a CSV file
You can open a CSV file in any of these programs without needing to convert it first:
- Microsoft Excel — Double-click the CSV file and it opens as a spreadsheet. You can edit it and save it back as CSV or convert it to Excel format (.xlsx).
- Google Sheets — Upload the CSV file or paste the contents into a new sheet. Google Sheets will automatically detect the columns.
- LibreOffice Calc — A free spreadsheet program that opens CSV files identically to Excel.
- Apple Numbers — The Mac equivalent of Excel, opens CSV files directly.
- Any text editor — Notepad, TextEdit, or any plain-text editor will display the raw comma-separated data, though it will not format it into columns.
When you open a CSV file in Excel or Google Sheets for the first time, the program may ask you to confirm how the data is separated (comma, semicolon, tab, etc.). In most cases, "comma" is already selected. Click OK and the data will appear in columns.
If you edit a CSV file in a spreadsheet program and save it, make sure you save it as CSV format, not as an Excel file. If you save it as .xlsx, the other program that sent you the file may not be able to read it back in.
What CSV cannot do
CSV stores only raw data and text. It does not preserve any of the formatting you might add in a spreadsheet program. If you color cells, make text bold, add formulas, or create multiple sheets, none of that will be saved when you export to CSV.
For example, if you open a CSV file in Excel and add a formula to calculate a total, then save it as CSV, that formula is lost. The CSV file will contain only the result of the formula, not the formula itself. If you need to preserve formulas and formatting, you would save the file as an Excel file (.xlsx) instead.
CSV also does not support images, charts, or other embedded objects. It is text-only. If your data includes anything beyond plain text and numbers, you need a different format.
Common problems when working with CSV files
The most frequent issue is that a CSV file opens in a text editor instead of a spreadsheet program, showing all the commas and line breaks as raw text. This usually happens on Windows when Excel is not set as the default program for CSV files. Right-click the CSV file, select "Open with," and choose Excel or another spreadsheet program.
Another common problem is that data appears in the wrong columns. This usually means the CSV file uses a different separator — a semicolon or tab instead of a comma. When you open the file in Excel or Google Sheets, look for an import dialog that lets you choose the separator. Select the correct one and the data will align properly.
If you see strange characters or symbols in the data, the file may have been saved with a different character encoding. Most CSV files use UTF-8 encoding, which handles English and most other languages correctly. If a file was created on an older system, it might use a different encoding. Most modern programs can detect and convert this automatically, but if you encounter this problem, opening the file in Google Sheets usually resolves it.
Exporting your own data to CSV
Most programs that store data — email clients, contact managers, banking websites, payroll systems — allow you to export your data as CSV. The steps vary by program, but the general process is: look for an "Export" or "Download" button, select CSV as the format, and the program creates a file you can save to your computer.
This is useful when you want to switch programs. For example, if you have contacts in one email program and want to move them to another, you export them as CSV from the first program, then import the CSV file into the second program. The data transfers cleanly because both programs understand the CSV format.
When you export data, check whether the first row contains headers. Most programs include them by default, which is helpful because it tells you what each column contains. If headers are missing, the first row of your actual data might be treated as headers when you import it elsewhere.
Frequently Asked Questions
Is CSV the same as an Excel file?
No. An Excel file (.xlsx) is a complex format that stores formatting, formulas, and multiple sheets. A CSV file is plain text with only data and commas. You can open a CSV in Excel, but Excel files cannot be opened in all programs the way CSV files can. CSV is simpler and more universal.
Can I edit a CSV file in Excel and keep it as CSV?
Yes. Open the CSV file in Excel, make your changes, then use "Save As" and select "CSV (Comma delimited)" as the file type. This keeps it in CSV format instead of converting it to Excel format. If you just click "Save," Excel may ask whether you want to keep the CSV format or switch to Excel format.
What happens if my data contains a comma?
The program automatically wraps that value in quotation marks so the comma inside does not get treated as a column separator. For example, "Johnson, Smith & Co" would be stored as "Johnson, Smith & Co" in the CSV file. When you open it in a spreadsheet program, it appears correctly in a single column.
Can I open a CSV file on my phone?
Yes, though it will not display as nicely as on a computer. Most phones have spreadsheet apps (Google Sheets, Excel for mobile) that can open CSV files. On Android, you can also open CSV files in Google Drive and view them as a spreadsheet. On iPhone, Files app can open CSV in Numbers or other compatible apps.
Why would a government agency send me a CSV file instead of an Excel file?
CSV is the standard for data sharing because it works with any program and any computer, regardless of what software you own. It also reduces file size and ensures the data cannot be accidentally altered by formulas or formatting. Government agencies use CSV to make sure everyone can access the data the same way.