Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Comma-separated values
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==General functionality== CSV formats are best used to represent sets or sequences of records in which each record has an identical list of fields. This corresponds to a single [[relation (database)|relation]] in a [[relational database]], or to data (though not calculations) in a typical spreadsheet. The format dates back to the early days of business computing and is widely used to pass data between computers with different internal word sizes, data formatting needs, and so forth. For this reason, CSV files are common on all computer platforms. CSV is a [[Delimiter-separated values|delimited]] text file that uses a [[Comma (punctuation)|comma]] to separate values (many implementations of CSV import/export tools allow other separators to be used; for example, the use of a "Sep=^" row as the first row in the *.csv file will cause [[Microsoft Excel|Excel]] to open the file expecting [[Caret (punctuation)|caret]] "^" to be the separator instead of comma ","). Simple CSV implementations may prohibit field values that contain a comma or other special characters such as newlines. More sophisticated CSV implementations permit them, often by requiring " ([[double quote]]) characters around values that contain reserved characters (such as commas, double quotes, or less commonly, newlines). Embedded double quote characters may then be represented by a pair of consecutive double quotes,<ref>*{{Citation |last= Creativyst |year= 2010 |title= How To: The Comma Separated Value (CSV) File Format |publisher= creativyst.com |access-date= May 24, 2010 |url= http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm |archive-date= April 4, 2021 |archive-url= https://web.archive.org/web/20210404114001/http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm |url-status= live }}</ref> or by prefixing a double quote with an [[escape character]] such as a [[backslash]] (for example in [[Sybase]] Central). CSV formats are not limited to a particular [[character set]].<ref name="rfc4180"/> They work just as well with [[Unicode]] character sets (such as [[UTF-8]] or [[UTF-16]]) as with ASCII (although particular programs that support CSV may have their own limitations). CSV files normally will even survive naïve translation from one character set to another (unlike nearly all proprietary data formats). CSV does not, however, provide any way to indicate what character set is in use, so that must be communicated separately, or determined at the receiving end (if possible). Databases that include multiple [[relation (database)|relation]]s cannot be exported as a single CSV file{{citation needed|date=September 2014}}. Similarly, CSV cannot naturally represent [[hierarchical]] or [[object-oriented]] data. This is because every CSV record is expected to have the same structure. CSV is therefore rarely appropriate for [[documents]] created with [[HTML]], [[XML]], or other markup or word-processing technologies. [[Statistical database]]s in various fields often have a generally relation-like structure, but with some repeatable groups of fields. For example, health databases such as the [[Demographic and Health Survey]] typically repeat some questions for each child of a given parent (perhaps up to a fixed maximum number of children). [[Statistical analysis]] systems often include utilities that can "rotate" such data; for example, a "parent" record that includes information about five children can be split into five separate records, each containing (a) the information on one child, and (b) a copy of all the non-child-specific information. CSV can represent either the "vertical" or "horizontal" form of such data. In a relational database, similar issues are readily handled by creating a separate relation for each such group, and connecting "child" records to the related "parent" records using a [[foreign key]] (such as an ID number or name for the parent). In markup languages such as XML, such groups are typically enclosed within a parent element and repeated as necessary (for example, multiple <code><child></code> nodes within a single <code><parent></code> node). With CSV there is no widely accepted single-file solution.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)