A Comma Separated Values (CSV) file is a plain text file that contains a list of data. These files are often used for exchanging data between different applications. For example, databases and contact managers often support CSV files.
The Structure of a CSV File
CSV files may sometimes be called Character Separated Values or Comma Delimited files. They mostly use the comma character to separate (or delimit) data, but sometimes use other characters, like semicolons. The idea is that you can export complex data from one application to a CSV file, and then import the data in that CSV file into another application.
A CSV file has a fairly simple structure. It’s a list of data separated by commas. For example, let’s say you have a few contacts in a contact manager, and you export them as a CSV file. You’d get a file containing text like this:
That’s all a CSV file really is. They can be more complicated than that, and can contain thousands of lines, more entries on each line, or long strings of text. Some CSV files may not even have the headers at the top, and some may use quotation marks to surround each bit of data, but that’s the basic format.
Bob Smith,bob@example.com,123-456-7890,123 Fake Street
Mike Jones,mike@example.com,098-765-4321,321 Fake Avenue
That simplicity is a feature. CSV files are designed to be a way to easily export data and import it into other programs. The resulting data is human-readable and can be easily viewed with a text editor like Notepad or a spreadsheet program like Microsoft Excel.
How to View a CSV File in a Text Editor
To view the contents of a CSV file in Notepad, right-click it in File Explorer or Windows Explorer, and then select the “Edit” command.
RELATED: Why You Need a Plain Text Editor
Notepad may have trouble opening the CSV file if it’s very large. In this case, we recommend you use a more capable plain text file editor like Notepad++. To view a CSV file in Notepad++ after installing it, right-click the CSV file and select the “Edit With Notepad++” command.
You’ll see the plaintext list of data in the CSV file. For example, if the CSV file was exported from a contacts program, you’d see information about each contact here, with the contact’s details sorted onto a new line. If it was exported from a password manager like LastPass, you’d see different website login entries on their own line here.
In Notepad, the “Word Wrap” feature can make the data harder to read. Click Format > Word Wrap to disable it and make each line of data stay on its own line for improved readability. You’ll need to scroll horizontally to read the full lines.
How to Open a CSV File in a Spreadsheet Program
You can also open CSV files in spreadsheet programs, which make them easier to read. For example, if you have Microsoft Excel installed on your computer, you can just double-click a .csv file to open it in Excel by default. If it doesn’t open in Excel, you can right-click the CSV file and select Open With > Excel.
If you don’t have Excel, you could upload the file to a service like Google Sheets or install a free office suite like LibreOffice Calc to view it.
Excel and other spreadsheet programs present the contents of a .CSV file as if it were a spreadsheet, sorting it into columns.
RELATED: How to Export a CSV file from MySQL Command Line
How to Import a CSV File Into an Application
If you just want to view the contents of a CSV file or work with it as a spreadsheet, that’s all you need to do. However, many CSV files are made for importing into other programs. You might export your contacts from Google Contacts, your saved passwords from LastPass, or a large amount of data from a database program. You can even export CSV from MySQL on the command line. The resulting CSV files can then be imported into applications that support that type of data.
RELATED: How to Export and Delete Saved Passwords in Chrome
Depending on the application from which you’re exporting data, you may need to select an appropriate CSV format for the target application. For example, Google Contacts can export contacts in either Google CSV (for Google Contacts) or Outlook CSV (for Microsoft Outlook) formats. Either way, you get a CSV file containing the data, but it’s organized in a slightly different way.
In an appropriate application, look for the “Import” or “Import CSV” option, which lets you select the CSV file to import. For example, in Microsoft Outlook, you can click File > Open & Export > Import/Export > Import From Another Program or File > Comma Separated Values to import contacts from a CSV file.
CSV files are something most people never need to bother with. But, if you’ve ever need to get information out of one application and into another, their simple format and portability are extremely convenient.