What a CSV file is and why you'd make one

A CSV file is a plain-text document that stores data in rows and columns, separated by commas. CSV stands for "comma-separated values." 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, so your data lines up in a grid.

You create a CSV file when you need to move data between different programs, back up a list of contacts, or prepare information for someone else to use. A CSV file works on any computer, any operating system, and in almost any program that handles data — which is why it's the standard format for sharing spreadsheets.

The simplest way to make a CSV file is to start in a spreadsheet program you already have, enter your data, and save it as CSV instead of the program's native format. If you're starting from scratch with no spreadsheet program, you can also type a CSV file directly in a text editor like Notepad.

Key Takeaways

  • A CSV file is a text document where commas separate columns and line breaks separate rows, readable by almost any program that handles data.
  • The easiest method is to enter your data in Excel or Google Sheets, then use "Save As" and choose CSV format.
  • If you type a CSV file in Notepad, each row must be on its own line, and values in each row must be separated by commas.
  • CSV files lose formatting like colors and fonts — they store only the raw data and structure.
  • Always test your CSV file by opening it in a spreadsheet program to confirm the columns and rows are in the right places.

Creating a CSV file from Excel or Google Sheets

If you already have your data in a spreadsheet, this is the fastest route. Open the file in Microsoft Excel or Google Sheets, make sure your data is organized with headers (column names) in the first row and data below, then save it as CSV.

In Microsoft Excel: Click File, then Save As. In the dialog box, choose a location for the file. In the "Save as type" dropdown, select "CSV (Comma delimited) (*.csv)". Type a name for your file and click Save. Excel will warn you that some features may be lost — this is normal, because CSV format doesn't store colors, fonts, or formulas. Click Yes to continue.

In Google Sheets: Click File, then read, then "Comma Separated Values (.csv)". Your browser will read the file to your Downloads folder with the same name as your spreadsheet. If you want to rename it first, click File, then Rename, type the new name, and then read.

After you save, open the CSV file in your spreadsheet program again to confirm it looks right. The data should still be in columns and rows. If a column is too narrow to display all the text, widen it by double-clicking the border between column headers — this is just a display issue and doesn't affect the file itself.

Creating a CSV file from scratch in Notepad

If you don't have a spreadsheet program or prefer to type the file directly, you can create a CSV in any text editor. Open Notepad (on Windows, search for "Notepad" in the Start menu; on Mac, open Applications, then Utilities, then TextEdit, and set the format to plain text).

Type your data with commas between values and a line break at the end of each row. Here's an example:

Name,Email,Phone Sarah Johnson,sarah@example.com,555-0142 Marcus Lee,marcus@example.com,555-0198 Diana Patel,diana@example.com,555-0156

The first row contains your column headers — the names of each column. Every row after that is one record. Each value is separated by a comma, with no spaces after the comma unless the space is part of the data itself.

When you're done typing, click File, then Save As. Choose a location, type a filename with the .csv extension (for example, "contacts.csv"), and click Save. The .csv extension tells your computer this is a CSV file. If you save it as a .txt file by mistake, you can rename it later by right-clicking the file, selecting Rename, and changing the extension to .csv.

Handling data that contains commas

If one of your data values contains a comma — for example, a company name like "Smith, Johnson & Associates" — you need to tell the CSV format that the comma is part of the data, not a column separator. Do this by wrapping that value in quotation marks.

Here's an example:

Name,Company,Phone Sarah Johnson,"Smith, Johnson & Associates",555-0142 Marcus Lee,Tech Solutions Inc,555-0198

The quotation marks around "Smith, Johnson & Associates" tell the program that everything inside them is a single value, even though it contains a comma. When you open the file in a spreadsheet program, the quotation marks disappear and the company name appears correctly in one cell.

If a value contains quotation marks, wrap it in quotation marks and double each internal quotation mark. This is rare in most data, but it's good to know if you're working with text that includes quotes.

Testing your CSV file

Before you send your CSV file to someone else or use it in another program, open it in a spreadsheet to confirm the structure is correct. Double-click the file or right-click it and select "Open with," then choose Excel, Google Sheets, or another spreadsheet program.

Check that each column header is in its own column, that data lines up correctly under the right headers, and that no values are split across multiple columns when they shouldn't be. If a value with a comma appears split into two columns, go back to your CSV file and add quotation marks around that value.

If you created the file in Notepad and something looks wrong, open it again in Notepad, fix the issue, save it, and test it again in the spreadsheet program. This cycle usually takes only a minute or two.

What gets lost when you save as CSV

CSV format stores only the raw data and the structure — which values go in which cells. It does not store formatting like cell colors, bold text, font sizes, or formulas. If you have a spreadsheet with colored cells or formulas that calculate values, those will disappear when you save as CSV.

If you need to keep the original file with all its formatting, save it in your spreadsheet program's native format (Excel files end in .xlsx, Google Sheets are stored online) and create a separate CSV copy for sharing or backup. This way you have both versions.

Formulas are replaced by their results. If a cell contains a formula that adds two numbers, the CSV file will contain only the final number, not the formula itself. This is usually what you want when sharing data with someone else, but it means you can't edit the formula in the CSV file.

Moving your CSV file to another program

Once you have a CSV file, you can open it in almost any program that works with data — accounting software, contact managers, database programs, or online tools. Each program has its own way of importing a CSV file, but the basic steps are similar: look for an "Import" or "Upload" button, select your CSV file, and the program reads the columns and rows.

Some programs ask you to confirm which column is which — for example, "which column contains the email address?" — before importing. This is normal and helps the program put your data in the right place.

If a program has trouble reading your CSV file, the most common causes are extra spaces after commas, values with commas that aren't wrapped in quotation marks, or line breaks in the middle of a value. Go back to your CSV file, fix the issue, save it, and try importing again.

Frequently Asked Questions

Can I open a CSV file in Excel or Google Sheets?

Yes. Double-click the CSV file or open your spreadsheet program, click File, then Open, and select the CSV file. The program will read the commas and display your data in columns and rows. You can edit the data in the spreadsheet, but if you save it in the spreadsheet's native format (like .xlsx for Excel), it will no longer be a CSV file.

What's the difference between CSV and Excel format?

CSV is plain text with commas as separators and works on any computer and in almost any program. Excel format (.xlsx) is proprietary to Microsoft and stores formatting, formulas, and multiple sheets. CSV is simpler and more portable; Excel is better if you need colors, fonts, or calculations.

Do I need to add spaces after the commas in a CSV file?

No. Spaces after commas can cause problems — the spreadsheet program may treat the space as part of the data. Type commas with no space after them unless the space is intentional data. Most spreadsheet programs ignore leading and trailing spaces anyway, but it's cleaner to leave them out.

Can I create a CSV file on my phone?

You can create one using a mobile spreadsheet app like Google Sheets or Microsoft Excel on your phone, then read it as CSV. Typing directly in a text editor on a phone is possible but awkward. Google Sheets is usually the easiest option because it stores your data online and lets you read as CSV in a few taps.

What if my data has line breaks within a cell?

Wrap that entire cell value in quotation marks. If a cell contains "Line 1" and "Line 2" on separate lines, type it as "Line 1" followed by an actual line break, then "Line 2", all inside quotation marks. Most spreadsheet programs handle this correctly, but test it by opening the file to confirm.