What is a CSV file?

Viewing a sample CSV file in notepad
Viewing a sample CSV file in notepad.

A CSV file is file containing comma separated values. It is basically a data file containing tabular data, for example a single sheet in an Excel spreadsheet. A single sheet within Excel can be exported as a CSV file. A CSV file contains column data separated by commas. It does not include any row, cell or column styles.

CSV files are typically used to exchange data between different applications including consumer, business and scientific applications. For example, you can export the data contained in a single Excel spreadsheet to a CSV which can then be imported into a different application such as a database.

CSV Header Row

Viewing the same sample CSV file in Excel
Viewing the same sample CSV file in Excel.

Some applications (such as Excel) which create and import CSV files treat the first line of a CSV file as the header row containing field (or column) names. A header row has the same format as a data row: field names separated by commas. Some application choose to ignore the first row since they may already know the data format, field names and the order in which the fields are defined. Some or all of the header fields may need to be wrapped in single or double quotation marks especially if the header extends across multiple lines. See multiple lines below.

File Encoding

CSV files can often (and are commonly) saved in a common encoding format such as ASCII or ISO-8859-1 Latin Encoding. This encoding is only suitable if the data does not contain characters outside of those used for west-european languages. In case the data contains such characters, it is more appropriate to use Unicode format for encoding the CSV file. Most commonly used unicode formats on the Windows platform are UTF-8, UTF-16 LE (LE = Litte-Endian, also referred to as just "Unicode" by Notepad) and UTF-16 BE (BE = Big Endian, notepad "Unicode Big Endian"). The encoding of the CSV file is indicated by the presence and signature of a Byte-Order-Mark.

Quoting Data

Data for each column within a row in a CSV file can be enclosed in single or double quotation characters. Some applications require such quotation if the field value contains line breaks or comma characters which are part of the field value. Commas appearing within such quoted fields are treated as a part of the field value and does not signify end-of-field. Note that this is a convention only and not all applications that import or export CSV files may follow this convention.

Convert XML to CSV using Exult.
Free 15-day Trial.

Swift XML Converter

Query & extract XML data into Microsoft Excel (XLS), Microsoft Access (MDB or ACCDB), or CSV.

Exult Standard

Convert XML into Microsoft Excel (XLS), Microsoft Access (MDB or ACCDB), or CSV.

Exult SQL Server

Shred and import XML into SQL Server.

Exult MySQL

Import XML data into automatically created MySQL tables.

Exult Oracle

Import XML into Oracle.