If you do a lot of work with Microsoft Excel or other spreadsheet software, then you probably have a good idea of how useful CSV files can be. CSV stands for comma-separated values and it can be seen as the text version of a spreadsheet or table.
CSV files can be incredibly useful when transferring data between machines and programs. While not all programs will be compatible with Microsoft Excel or other spreadsheet file formats, the CSV is a pretty universal file format that most programs can utilize for storing data.
What is a CSV file?
If a spreadsheet file stores a highly detailed table and the values within it, a CSV file would be considered a minimally detailed text version of that table. Here is an example of a table and how a CSV would save the data.
|John||21||123 Smith St|
|Maddie||26||321 College Rd|
John,21,123 Smith St
Maddie,26,321 College Rd
Since a CSV file solely consists of text, it can be opened by a normal text editor such as Notepad or Word. It also means that the file size of a CSV compared to a spreadsheet will be significantly smaller and easy to transfer. Because a CSV behaves like a text file, it’s much easier to utilize with a range of programs and can be a favorite when looking to transfer data between systems and programs.
Creating a CSV in a Text Editor
Creating a CSV file within a text editor like Notepad is pretty straightforward and easy. Simply open up your text editor and begin filling in your data. Use commas to separate different data values and put them in different columns. All data values on the same line will be put into the same row, once you hit enter and begin a new line then you will be filling in the next row.
Once you are done inputting your data, use the ‘save as’ function in your text editor and save the file with the extension “.csv”
When you open up the .csv file in a spreadsheet program like Microsoft Excel, it should go from looking something like this:
To something like this:
But what happens if one of your data entries incorporates a comma, but you don’t want it separated? Using double quotes to surround the data entry will ensure the comma stays within your data instead of being interpreted as a separate item.
Here is an example:
|John||Engineer||123 Street St. Georgetown, Texas|
|Maddie||CEO||221 Oak Rd. Johnston, Georgia|
The CSV form would need to look like this:
John,Engineer,“123 Street St. Georgetown, Texas”
Maddie,CEO,“221 Oak Rd. Johnston, Georgia”
The use of double quotes denotes that the entire string of characters is part of the data entry, and allows the system to differentiate between a comma used to separate columns.
CSV files can be really useful when you are sharing data between multiple programs or systems. It’s also a great way to store data in a lightweight form that won’t take up a lot of room on your hard drive. Using text editors like Notepad or Notepad++ is a simple way to edit the data and makes it pretty easy to change up your data entry.
You may also want to check out this article on how to protect your data and ensure the hard work you put into your CSV files doesn’t go to waste.