33 Delimiter-separated formats (CSV)

CSV files (Comma-separated values) are used to store tabular data (numbers and text) in plain text. "Plain text" means that the file is a pure string of characters without any hidden information that the computer has to process.

A CSV file stores data without a "record" number, separated by line breaks (each line of the file is a data "record"). Each record has one or more "fields" separated by a delimiter, most commonly a comma (","), semicolon (";") or the "invisible" character that appears when you press the "tab" key. Files separated by commas and semi-colons usually receive the "CSV" extension and files separated by a "tab" the "TSV" extension. There are also databases in these formats that receive the "TXT" extension. CSV files are simple and work in most applications that deal with structured data.

Making a comparison with rows and columns in a spreadsheet, the "records" in a CSV file are the rows and the "fields" are the columns. The first "record," which is the first line, usually contains column names for each of the "fields." Although an international standard does not exist for CSV, its variations are simple enough so that compatible applications can easily fix the differences. Typically, this is how a CSV file is displayed when opened in a text editor:

Continente;País;Capital
África;Angola;Luanda
América do Norte;Estados Unidos;Washington DC
América Central;México;Cidade do México
América do Sul;Brasil;Brasília
Europa;Espanha;Madri
Europa;Alemanha;Berlim
Oceania;Austrália;Camberra
Ásia;Japão;Tóquio

This file contains three columns separated by the semicolon (";") delimiter: Continent, Country and Capital, as described in the first line. In all there are eight records. The first triad is Africa-Angola-Luanda and the last is Asia-Japan-Tokyo. There is no practical limit to the number of lines or columns in a CSV file. This number can reach millions or tens of millions, depending only on the processing power of the computer that will be used in querying. If the same CSV file was opened in a spreadsheet processor, it would be displayed like this:

Continente País Capital
África Angola Luanda
América do Norte Estados Unidos Washington DC
América Central México Cidade do México
América do Sul Brasil Brasília
Europa Espanha Madri
Europa Alemanha Berlim
Oceania Austrália Camberra
Ásia Japão Tóquio