What a CSV file is and why you need one
A CSV file (comma-separated values) is a plain-text document that stores data in rows and columns, separated by commas. When you open it in a spreadsheet program like Microsoft Excel or Google Sheets, the commas tell the program where each column starts and stops. The result looks like a table, but the file itself is just text — which is why CSV files work on any computer, any operating system, and any program that reads text.
You create a CSV file when you need to move data between programs, share information with someone who uses different software than you do, or back up your data in a format that will never become obsolete. A CSV file created in 1995 opens the same way today. An Excel file from 1995 may not.
Key Takeaways
- A CSV file is a text document where commas separate columns and line breaks separate rows — any spreadsheet program can open it.
- You can create a CSV file by typing data directly into a text editor, exporting from Excel or Google Sheets, or converting an existing spreadsheet.
- The first row should contain column headers (like "Name", "Email", "Phone") so the data makes sense when someone else opens it.
- If your data contains commas, you must wrap those cells in quotation marks so the program does not mistake the comma for a column separator.
- Save the file with a .csv extension so programs recognize it as a spreadsheet file, not a text document.
Creating a CSV file by exporting from Excel
If your data already lives in Microsoft Excel, exporting to CSV takes three steps. Open the spreadsheet, click File in the top left, then click Save As.
A dialog box appears. Near the bottom, you will see a dropdown menu that says "Excel Workbook" or similar. Click that dropdown and select CSV (Comma delimited) from the list. Choose where you want to save the file, give it a name, and click Save. Excel will warn you that some features may be lost — this is normal and expected. Click Yes to confirm.
The file is now saved as a CSV. You can open it again in Excel, Google Sheets, or any text editor. If you open it in a text editor like Notepad, you will see the raw data with commas between values — this is the actual CSV format underneath.
Creating a CSV file from Google Sheets
Google Sheets makes CSV export equally straightforward. Open your spreadsheet, click File at the top left, then hover over read. A submenu appears with several format options. Click Comma Separated Values (.csv).
The file downloads to your computer's default read folder with the name of your spreadsheet plus ".csv". You can rename it afterward if you want a different name. Unlike Excel, Google Sheets does not ask for confirmation — the read happens when ready.
Creating a CSV file by hand in a text editor
If you have only a small amount of data or want to build a CSV from scratch, you can type it directly into a text editor. Open Notepad (Windows), TextEdit (Mac), or any plain-text editor. Do not use Microsoft Word or Google Docs — these add formatting that breaks CSV files.
Type your data with commas between columns and press Enter at the end of each row. The first row should contain your column headers. Here is an example:
Name,Email,Phone,City Sarah Johnson,sarah@example.com,555-0142,Portland Marcus Chen,marcus@example.com,555-0198,Seattle Lisa Patel,lisa@example.com,555-0156,Denver
Save the file with a .csv extension at the end of the filename — for example, "contacts.csv" instead of "contacts.txt". When you save, the text editor may ask what format to use. Choose UTF-8 if given the option, as this handles special characters correctly.
Handling data that contains commas
If any of your data contains a comma — for example, an address like "123 Main St, Apt 4" — you must wrap that cell in quotation marks. Otherwise, the program will think the comma is a column separator and split your data incorrectly.
Here is an example with addresses that contain commas:
Name,Email,Address Sarah Johnson,sarah@example.com,"123 Main St, Apt 4" Marcus Chen,marcus@example.com,"456 Oak Ave, Suite 200"
The quotation marks tell the program "everything between these quotes is one cell, even though it contains a comma." When you open the file in Excel or Google Sheets, the quotation marks disappear and the address appears correctly in a single column.
Checking your CSV file before sharing
After you create a CSV file, open it in a spreadsheet program to verify the data looks correct. Open Excel or Google Sheets, then use File > Open and select your CSV file. The data should appear in neat rows and columns with no stray commas or broken cells.
If columns are misaligned or data appears in the wrong place, go back to your original file and check for unquoted commas or other formatting problems. Common issues include forgetting quotation marks around addresses or phone numbers that contain punctuation, or accidentally pressing Tab instead of comma between values.
Once the data looks correct in the spreadsheet view, your CSV file is ready to share, back up, or import into another program.
Frequently Asked Questions
Can I create a CSV file on my phone or tablet?
Yes, but it is easier on a computer. On a phone, use Google Sheets (available free on iPhone and Android), create your spreadsheet, then export it as CSV using the menu. The file saves to your phone's storage or cloud drive. Desktop and laptop computers give you more control and make it easier to edit the raw text if needed.
What is the difference between CSV and Excel files?
CSV is plain text with commas; Excel is a proprietary format that stores formatting, formulas, and multiple sheets. CSV works everywhere and never becomes outdated. Excel files can become unreadable if the software is no longer supported. For long-term storage or sharing across different programs, CSV is more reliable.
Do I need to add quotation marks around all text, or just cells with commas?
Only cells that contain commas need quotation marks. You can add them to every cell if you want — it does not hurt — but it is not necessary. Most people only quote the cells that need it to keep the file readable when opened in a text editor.
What happens if I open a CSV file in Excel and then save it as Excel format?
The data converts to Excel's format and gains the ability to store formulas, colors, and multiple sheets. If you later save it back as CSV, those extra features are lost. For this reason, keep your original CSV file as a backup if you plan to edit it in Excel.
Can I import a CSV file into another program?
Yes — that is one of the main reasons to use CSV. Most programs that work with data (accounting software, email services, databases, contact managers) have an import feature that reads CSV files. Check the program's documentation for the exact steps, but the process is usually File > Import > Select Your CSV File.