Francais | English | Espanõl

Comma-separated values

From Wikipedia, the free encyclopedia

Jump to: navigation, search
Comma-separated values <tr><th style="white-space: nowrap;">File extension:</th><td>.csv</td></tr><tr><th style="white-space: nowrap;">MIME type:</th><td>text/csv
text/comma-separated-values (deprecated)
</td></tr>

The comma-separated values (or CSV) file format is a delimited data format that has fields separated by the comma character and records separated by newlines. Fields that contain a comma, newline, or double quote character, or which start or end with whitespace that is to be preserved, must be enclosed in double quotes. However, if a line contains a single entry which is the empty string, it may be enclosed in double quotes. If a field's value contains a double quote character it is escaped by placing another double quote character next to it. The CSV file format does not require a specific character encoding, byte order, or line terminator format.

CSV is one implementation of the Delimiter-separated values file format, which can use any character as the delimiter. Many applications in fact allow .csv-named files to use any delimiter character. However CSV differs from other delimiter separated file formats in using a " (double quote) character around fields that contain reserved characters (such as commas or newlines). Most other delimiter formats either use an escape character such as a backslash, or have no support for reserved characters.

Contents

[edit] Specification

While no formal specification for CSV exists, RFC 4180 describes a common format and establishes "text/csv" as the MIME type registered with the IANA.

Many informal documents exist that describe the CSV format. How To: The Comma Separated Value (CSV) File Format provides an overview of the CSV format in the most widely used applications and explains how it can best be used and supported.

[edit] Example

1997FordE350ac, abs, moon3000.00
1999ChevyVenture "Extended Edition" 4900.00
1996JeepGrand CherokeeMUST SELL!
air, moon roof, loaded
4799.00

The above table of data may be represented in CSV format as follows:

1997,Ford,E350,"ac, abs, moon",3000.00
1999,Chevy,"Venture ""Extended Edition""",,4900.00
1996,Jeep,Grand Cherokee,"MUST SELL!
air, moon roof, loaded",4799.00

[edit] Application support

The CSV file format is a very simple data file format that is supported by almost all spreadsheet software applications. Many database management systems and programming languages also support the reading and writing of CSV files.

[edit] See also

[edit] External links

de:CSV-Datei es:CSV fr:Comma-separated values it:CSV ja:カンマ区切りテキスト nl:Kommagescheiden bestand pl:CSV ru:CSV sv:Csv uk:CSV

Personal tools