Skip to content
Latchkey

What Is CSV? Comma-Separated Values Explained

CSV (Comma-Separated Values) is a plain-text format for tabular data where each line is a row and commas separate the columns.

CSV is the simplest way to move tabular data between programs. Every spreadsheet, database, and data tool can import and export it. Its simplicity is also its weakness: there is no single official spec, so quoting and edge cases differ between tools - which matters when a data pipeline parses CSV in CI.

What CSV is

A CSV file is plain text where each line is a record and fields within a record are separated by commas. An optional first line holds column headers. It maps naturally to a table or a spreadsheet, which is why it is the universal interchange format for rows of data.

Quoting and escaping

The tricky part is data that contains commas, quotes, or newlines. The convention is to wrap such a field in double quotes and to escape an embedded quote by doubling it. Tools disagree on the fine details, so a field with a comma inside it is a classic source of misparsed CSV.

Why CSV has no real standard

There is an informal spec (RFC 4180) but in practice delimiters, line endings, encodings, and quoting vary. A file exported on Windows may use CRLF line endings, a European export may use semicolons instead of commas, and encodings range from UTF-8 to legacy code pages.

CSV in data pipelines and CI

Data pipelines frequently ingest CSV from exports and APIs, then validate and transform it. In CI you test those transforms against small CSV fixtures, and you may have a job that asserts a generated report CSV has the expected columns and row count before publishing it.

Checking CSV output in a job
# Validate a generated CSV in CI
steps:
  - run: python export_report.py > report.csv
  - run: |
      header=$(head -1 report.csv)
      test "$header" = "date,builds,minutes"

Latchkey note

CSV-handling jobs are plain compute and often pull sample datasets. On Latchkey you can cache those fixtures between runs so a data-validation job is not re-downloading the same sample files every build.

Key takeaways

  • CSV is plain text where each line is a row and commas separate columns, ideal for tabular data.
  • Quoting and escaping rules for embedded commas and quotes vary between tools, so CSV is easy to misparse.
  • Data pipelines ingest and emit CSV, and CI should validate it against fixtures and expected columns.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →