Comma-Separated Values File (CSV)

Definition - What does Comma-Separated Values File (CSV) mean?

A comma separated values (CSV) file contains different values separated by a delimiter, which acts as a database table or an intermediate form of a database table. In other words, a CSV file is a set of database rows and columns stored in a text file such that the rows are separated by a new line while the columns are separated by a semicolon or a comma. A CSV file is primarily used to transport data between two databases of different formats through a computer program.

Techopedia explains Comma-Separated Values File (CSV)

The following sequence illustrates a typical CSV file:

John Smith, 50, $5000, New York
David Benz, 36, $10000, Miami

Note that each the line of text corresponds to a row in the database table. The various columns are represented with comma. Generally, the following are true:

  • The leading and trailing spaces are generally ignored when conversion is being made from CSV to a typical database.

  • Double quotes are used to delimit embedded commas.

  • A field that contains double quotes is surrounded by double quotes and the embedded double quotes in the field are also surrounded by an additional pair of double quotes.

  • A field that has embedded line breaks is also surrounded by double quotes.
  • The fields at the top row indicate the column names of the target table into which the CSV file will be converted.

The advantage of using CSV file format for data exchange is that the CSV file is relatively easy to process by any application and data extraction can be achieved with the help of a simple program. In the earlier years when database technologies were still in their infancy, the CSV was the most standard portable format. For the most part, a CSV file would only be used for a relatively simple application, while XML would be used for a transfer involving more complexity.

Share this: