CSV: Difference between revisions

From WikiMD's Wellness Encyclopedia

CSV import
 
CSV import
Line 64: Line 64:


{{Comp-sci-stub}}
{{Comp-sci-stub}}
{{No image}}

Revision as of 09:22, 10 February 2025


Comma-Separated Values



Filename extension.csv
Internet media type
Uniform Type Identifier (UTI)
Magic number
Developed by
Initial release
Latest release
Type of format
Container for
Contained by




Comma-Separated Values (CSV) is a file format used to store tabular data (such as a database or spreadsheet) in plain text. Each line of the file is a data record, and each record consists of one or more fields, separated by commas. This format is widely supported by applications like spreadsheet software, database management systems, and data analysis tools, making it a simple and flexible format for data interchange and storage.

Overview

CSV files are simple text files where each line represents a data record. Each record consists of fields, which are separated by a delimiter, typically a comma. However, other delimiters like semicolons can also be used. The use of the comma as a field separator is the source of the name for this file format.

The simplicity of CSV files makes them easy to generate and edit manually or programmatically. They are also easy to import into and export from applications that handle data in tabular formats. Despite the name, CSV files can use characters other than the comma to separate data fields.

Structure

A CSV file typically consists of a series of rows, each of which represents a single record or data item. The first row often contains headers, which are labels for the data fields. Each subsequent row corresponds to a data record, with the values in the same order as the headers.

Example of a CSV file

``` Name,Age,City Alice,30,New York Bob,25,Los Angeles Charlie,35,Chicago ```

In this example, each line represents a different person's record, and each person's record is divided into three fields: Name, Age, and City.

Usage

CSV files are used in numerous applications:

Advantages and Disadvantages

Advantages

  • Simple format that can be read and written by many software tools.
  • Human-readable and easy to edit manually.
  • Flexible for integration with various systems.

Disadvantages

  • Lacks a standard schema, leading to potential inconsistency in data interpretation.
  • Does not support complex structures like nested or hierarchical data.
  • Limited support for data types; everything is stored as text.

Standards

The most notable standard for CSV files is RFC 4180, which defines the format as MIME type text/csv. This RFC provides guidelines on the format of the headers, record delimiters, and handling of special characters (such as quotes and commas within data fields).

See Also


Stub icon
   This article is a computer science stub. You can help WikiMD by expanding it!