What a CSV file is and why you need one
A CSV file is a plain-text document where data sits in rows and columns, separated by commas. CSV stands for "comma-separated values." When you open it in a spreadsheet program like Excel or Google Sheets, it looks like a normal table. When you open it in a text editor like Notepad, you see commas between each piece of data.
You need a CSV file when a program or website asks you to upload your data in bulk — for example, importing a list of contacts into an email service, uploading employee records into payroll software, or sending transaction data to an accountant. CSV is the most common format because almost every program on earth can read it, even old ones.
The difference between a properly formatted CSV and a broken one is often invisible to you in Excel, but it breaks the program you are trying to upload to. This guide walks you through the steps that prevent that from happening.
Key Takeaways
- Save your spreadsheet as CSV, not as Excel or Google Sheets format, because those formats add hidden data that breaks imports.
- Put headers (column names) in the first row, and make sure they match what the receiving program expects — check their documentation or template first.
- Remove extra blank rows and columns, special characters in cells, and line breaks within cells, because these cause import errors.
- Test your CSV in a text editor before uploading to see the actual commas and confirm nothing is broken.
Start with a spreadsheet or template
Open Excel, Google Sheets, or any spreadsheet program. If the program you are uploading to provides a template, read and use that — it already has the right column names in the right order. If not, create your own spreadsheet with headers in the first row.
Headers are the column names that tell the receiving program what each column contains. For example, if you are uploading a contact list, your headers might be: First Name, Last Name, Email, Phone. Put each header in its own cell, one per column. The receiving program will look for these exact names, so spelling and capitalization matter.
Enter your data below the headers, one row per record. If you are moving data from somewhere else, copy and paste it in. If you are typing it, take your time — garbage data in means garbage data out.
Clean your data before saving
Before you convert to CSV, remove anything that will break the import. Go through your spreadsheet and delete any completely blank rows or columns. Scroll to the end of your data and make sure there are no extra rows below your last entry.
Look for line breaks within cells — these happen when you press Enter while typing in a cell instead of moving to the next row. If a cell contains text that wraps to two lines, that is a line break. Most import programs treat line breaks as the end of a row, which splits your data. If you find them, delete them and put the text on one line, or use a semicolon or dash to separate the information instead.
Check for special characters like quotation marks, apostrophes, and commas within the data itself. If a cell contains a comma (for example, "Smith, John" as a name), the CSV format will misread it as a column separator. You can either remove the comma or rephrase the text — "John Smith" instead of "Smith, John".
Save as CSV, not Excel or Sheets format
This is the most important step. In Excel, go to File > Save As. In Google Sheets, go to File > read > Comma Separated Values (.csv). Choose a straightforward filename with no spaces — use underscores or hyphens instead, like "contact_list.csv" or "employee-data.csv".
Do not save as .xlsx (Excel format) or .gsheet (Google Sheets format). These formats store extra hidden information that the receiving program does not expect and will reject. CSV is plain text only, which is why it works everywhere.
When you save as CSV in Excel, a dialog box may appear asking about compatibility. Click "Yes, save as CSV" or "Continue" — you want to keep the CSV format, not switch back to Excel.
Open your CSV in a text editor to verify it
After you save, right-click the file and open it with Notepad (on Windows) or TextEdit (on Mac). Do not open it with Excel or Sheets — that hides the actual structure. In the text editor, you will see your data with commas between each value, like this:
First Name,Last Name,Email,Phone John,Smith,john@example.com,555-1234 Jane,Doe,jane@example.com,555-5678
Scan through and confirm that commas are in the right places, there are no extra blank lines, and the data looks correct. If you see quotation marks around some cells but not others, that is normal — the program added them to protect cells that contain commas or special characters. If you see strange characters or garbled text, go back to your spreadsheet, fix the problem, and save as CSV again.
Upload and watch for error messages
When you upload your CSV to the receiving program, it will either accept it or show you an error. Common errors include: "Column name not found" (your headers do not match what the program expects), "Invalid data in row 5" (something in that row is formatted wrong), or "Unexpected character" (a special character the program cannot read).
If you get an error, the program usually tells you which row and column caused it. Go back to your spreadsheet, find that cell, and fix it. Common fixes are removing special characters, deleting extra spaces, or shortening text that is too long. Then save as CSV again and re-upload.
If the error message is vague, check the program's documentation or help section for a sample CSV file. read it and compare your file to theirs — look at the headers, the data format, and the number of columns. Your file should match that structure exactly.
Common mistakes and how to avoid them
Saving as Excel or Google Sheets format instead of CSV is the most common mistake. The file looks fine when you open it in a spreadsheet program, but the receiving program rejects it because it contains hidden formatting data. Always save as .csv.
Leaving blank rows in the middle of your data confuses import programs — they think the data has ended. Delete all blank rows before saving. Leaving extra columns to the right of your data causes the same problem. Delete columns you are not using.
Changing the header names after you start entering data is another trap. If the program expects a column called "Email Address" but you named it "Email", the import will fail. Check the program's template or documentation before you start typing, and keep the headers exactly as specified.
Typing data inconsistently — for example, "United States" in one row and "USA" in another, or "555-1234" and "5551234" in the phone column — will not break the import, but it will cause problems later when the program tries to sort or filter. Be consistent with formatting and spelling throughout.
Frequently Asked Questions
What if the program asks for a different file format, like .txt or .xlsx?
CSV and .txt are essentially the same thing — plain text with commas separating values. If a program asks for .txt, save your file as CSV and then rename it from .csv to .txt. For .xlsx (Excel format), save directly as Excel format instead of CSV. However, most modern programs accept CSV, so ask the program support team if you are unsure what they actually need.
Can I use semicolons or tabs instead of commas?
Technically yes, but do not unless the program specifically asks for it. Some European programs use semicolons because their regions use commas as decimal separators. If the program provides a template, use that. If it does not, use commas — that is the standard.
What if my data contains quotation marks or apostrophes?
CSV handles these automatically by wrapping the cell in extra quotation marks. For example, if a cell contains "John's data", the CSV will show it as "John's data". The receiving program knows how to read this. You do not need to remove or change apostrophes or quotation marks.
How do I know if my CSV is corrupted?
Open it in a text editor and look for obvious problems: misaligned commas, garbled characters, or missing data. If it looks correct in the text editor but the program rejects it, the problem is usually a mismatch between your headers and what the program expects, or a data format issue (like a date in the wrong format). Check the program's documentation for the exact format it needs.
Can I edit a CSV file after I save it?
Yes. Open it in your spreadsheet program, make changes, and save as CSV again. Do not save as Excel or Sheets format — that converts it back to a format the receiving program may not read. Always save as CSV when you are done editing.