csvGetting started with csv


Remarks

csv is an acronym that stands for comma-separated values. A csv file is plain text however the characters may be encoded in any of a variety of ways. Each line in such a file represents a single record. A csv file's contents are to be understood as the contents of a table in which each record represents one row of the tables. Although the acronym indicates that the values in lines are separated by commas they may, in fact, be separated by any character, and string values may be escaped by, for instance, apostrophes or double quotation marks. Often the first line of a csv file is formatted is the same way as subsequent lines but contains identifiers for the data in them; in these files this first line provides headers for the table represented by the file.

csv files are heavily used for storing and transmitting data. Most full-blown languages and systems include, or provide access to, means for parsing lines within such files for their values.

Installation or Setup

A CSV file itself requires no installation as it is just a plain text file, usually with .csv extension.

A CSV file usually contains records. Each line represents one record and is separated by a delimiter, most commonly a comma; but semicolons and tabs are also frequently used. Each line should have the same number of fields.

example.csv:

Name,Age,Skill,Height,Friendly
Bob,22,10,6.3,yes
Frank,12,7,5.5,no
 

Processing csv files in various systems and languages

Small, simple csv files can be built using just a text editor, because a CSV file is simply text. If you have spreadsheet software available these are usually an easy way to open and save CSV files.

Reading and writing them, or otherwise processing their contents is done more efficiently using the products available for one's language or systems of choice.