What Is a CSV File Extension?

By Scott Miller

CSV stands for "comma seperated values." It is one type of plain text file. The only difference between a .csv file and files commonly referred to as text files (.txt) is that the text in the file is organized and data is separated by commas.


Two factors separate a .csv file from a generic text file. The data or values are separated by commas and each set of values (each record in database terminology) is in one line. Sometimes there is a character identifying the end of a record in addition to the end of line character (which is not visible) in the text file.


Almost any computer program on any platform can use text files (and comma delimited value text files) for input and output, Microsoft programs such as Word and Excel, scripting languages such as PHP and databases such as mySQL can all use text files for input and output.Since .csv files are organized into values and rows they are even more convenient for the data manipulating uses (such as with Excel, PHP and mySQL).


Use .csv files when you want data input or output in a list or table. This file type is particularly well suited when input and output are for different applications. For example, you could create a file in Word and then, using the save as dialog box, save it as a .csv file. Then, you could import that .csv file into a mySQL database table.


A .csv file can be used anywhere a plain text file can be used. In addition, it can be used anywhere you want information organized in a line by line list. It can also be used as a common file format between different applications.These files can be used to populate variables or arrays in PHP or perl scripts. They can also be used and manipulated as ad hoc database languages like these.


The .csv format allows (but does not require) one line of data that is the names of the data fields. When using .csv with applications, such as Word and Excel, create the name row. It will make using the Microsoft Wizards much easier.In a default install of Excel, .csv is associated with Excel. If you open a .csv in Excel and modify it, remember to save as .xls to keep all changes.When using .csv with scripting languages, remember to strip special characters and trap for other coding (such as HTML or PHP).

References & Resources