What a CSV file is and why you might have 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." You'll encounter them when you export contact lists from email, download transaction records from your bank, pull data from online surveys, or receive spreadsheets from colleagues who saved them in a format that works across different programs.

The reason CSV files exist is portability: almost any program that works with data can read them, regardless of whether you own Microsoft Office, use Google Sheets, or work on a Mac or Windows machine. When someone sends you a CSV file, they're usually sending you something that will open anywhere.

The trade-off is that CSV files are bare-bones. They contain only the data itself—no colors, formulas, or formatting. If you need to edit the data or do calculations, you'll want to open the CSV in a spreadsheet program rather than a text editor.

Key Takeaways

  • CSV files open in spreadsheet programs like Microsoft Excel, Google Sheets, or LibreOffice Calc, which display the data in rows and columns.
  • You can also open a CSV file in any text editor (Notepad, Word, TextEdit), but you'll see the raw comma-separated text without formatting.
  • Double-clicking a CSV file usually opens it in whatever spreadsheet program is set as your default, which you can change in your system settings.
  • If the data looks jumbled when you open it, use your spreadsheet program's "Text to Columns" or import feature to tell it where the commas are.

Opening a CSV file in a spreadsheet program on Windows

The easiest route on Windows is to right-click the CSV file, select "Open with," and choose a spreadsheet program from the list. Microsoft Excel is the most common choice, but Google Sheets (if you have a Google account) and LibreOffice Calc (free, no account needed) work just as well.

If you have Excel installed and want to make it your default program for CSV files, right-click the CSV file, select "Open with," then "Choose another app." Find Excel in the list, check the box that says "Always use this app to open .csv files," and click "Open." After that, double-clicking any CSV file will open it directly in Excel without the menu.

When the file opens in a spreadsheet program, the data will appear in a grid with each column separated by a comma in the original file. If the data looks wrong—for example, if all the information is crammed into one column—your spreadsheet program may not have recognized the commas as separators. See the section below on fixing misaligned data.

Opening a CSV file on a Mac

On a Mac, right-click (or Control-click) the CSV file and select "Open With." You'll see options like Numbers (Apple's spreadsheet program), Google Sheets, or Excel if you have it installed. Choose whichever you prefer, and the file will open in that program.

If you want to set a default program, right-click the CSV file, select "Get Info," and under "Open with" choose the program you want to use. Then click "Change All" to make that program the default for all CSV files on your computer.

Numbers and Excel on Mac both display CSV data in a grid format. If the columns don't line up correctly, Numbers will prompt you to specify how the data is separated when you open the file—select "comma" from the options and the data should align properly.

Opening a CSV file in Google Sheets

If you use Google Drive, you can upload a CSV file directly to Google Sheets without installing anything. Go to drive.google.com, click "New" on the left side, select "File upload," and choose your CSV file from your computer. Once it uploads, right-click the file and select "Open with" > "Google Sheets."

Google Sheets will import the CSV and display it in a spreadsheet. If the data doesn't separate into columns correctly, go to the menu, select "Data" > "Text to Columns," choose "Comma" as the separator, and click "Data to Columns." Google Sheets will then split the data into the correct columns.

The advantage of Google Sheets is that your file is saved in the cloud, you can share it with others for real-time collaboration, and you can access it from any device with an internet connection. You can also download it back as a CSV file later if you need to send it to someone else.

Opening a CSV file in a text editor

If you only need to look at the raw data without editing it, you can open a CSV file in any text editor. On Windows, right-click the file, select "Open with," and choose Notepad. On a Mac, right-click, select "Open With," and choose TextEdit.

When you open a CSV file in a text editor, you'll see the data as plain text with commas between values. For example, a contact list might look like this: John,Doe,john@example.com,555-1234. This view is useful if you need to check the raw structure of the file or make quick edits, but it's harder to read than a spreadsheet view, especially if you have many columns.

If you edit a CSV file in a text editor and save it, make sure you save it with the .csv extension at the end of the filename. If you accidentally save it as a .txt file, it will no longer open as a spreadsheet by default.

Fixing data that doesn't line up in columns

Sometimes when you open a CSV file, all the data appears in a single column instead of spreading across multiple columns. This usually means the spreadsheet program didn't recognize the comma as a separator. The fix depends on which program you're using.

In Microsoft Excel, select all the data (Ctrl+A on Windows, Cmd+A on Mac), go to the "Data" menu, and click "Text to Columns." A dialog box will open. On the first screen, select "Delimited" and click "Next." On the second screen, check the box next to "Comma" and uncheck any other boxes. Click "Finish," and Excel will split the data into the correct columns.

In Google Sheets, select the column with all the data, go to "Data" > "Text to Columns," choose "Comma" as the separator, and click "Data to Columns." The data will split immediately.

In LibreOffice Calc, the import dialog usually appears automatically when you open a CSV file. Make sure "Comma" is checked under "Separator Options" and click "OK." If the dialog doesn't appear, go to "Sheet" > "Insert Sheet from File" and select your CSV file.

Saving changes to a CSV file

If you open a CSV file in a spreadsheet program, make changes, and want to save it as a CSV again, use "Save As" rather than "Save." In Excel, go to "File" > "Save As," choose "CSV (Comma delimited)" from the file type dropdown, and click "Save." In Google Sheets, go to "File" > "Download" > "Comma-separated values (.csv)." In LibreOffice Calc, go to "File" > "Save As" and select "CSV" from the file type list.

Be aware that if your spreadsheet contains formatting (colors, bold text, formulas), that formatting will be lost when you save as CSV. CSV files store only the raw data. If you need to preserve formatting, save the file in your spreadsheet program's native format (Excel's .xlsx, Google Sheets' native format, or LibreOffice's .ods) instead.

Frequently Asked Questions

Can I open a CSV file in Microsoft Word?

Yes, but it's not recommended. Word will open a CSV file as plain text, showing all the commas, which makes it hard to read. If you need to view or edit the data, use a spreadsheet program instead. Word is designed for documents, not data.

What if my CSV file won't open in any program?

The file may be corrupted, or your computer may not have a spreadsheet program installed. Try opening it in a text editor first to see if the data is readable. If it is, install LibreOffice Calc (free) or use Google Sheets. If the text editor shows gibberish, the file is likely corrupted and cannot be recovered.

Why does my CSV file open in Excel but look wrong?

Excel sometimes misinterprets how the data is separated, especially if your data contains special characters or was created on a different type of computer. Use the "Text to Columns" feature (described above) to tell Excel that the separator is a comma, and it should fix the problem.

Can I convert a CSV file to an Excel file?

Yes. Open the CSV file in Excel, go to "File" > "Save As," choose "Excel Workbook (.xlsx)" from the file type dropdown, and click "Save." The data will be saved in Excel's native format, which supports formatting and formulas that CSV does not.

Is it safe to open a CSV file from someone I don't know?

A CSV file itself is just data—it cannot run code or install software. However, if the file came as an email attachment from an unknown sender, treat it with the same caution you would any attachment. Scan it with your antivirus program first, or open it in a text editor to see what it contains before opening it in a spreadsheet program.