Skip to content
CSV Basics
step 1/5

Reading — step 1 of 5

Read

~1 min readThe Basics

CSV Basics

CSV (Comma-Separated Values) is the lingua franca of tabular data. Conceptually trivial:

name,age,city
Alice,30,NYC
Bob,25,LA

Each line is a row; commas separate columns; the first row is often a header.

In practice CSV is shockingly inconsistent across tools:

  • Excel uses ; in some locales (because comma is the decimal separator)
  • Different line endings (\n vs \r\n vs \r)
  • Different quote characters (" is standard but ' happens)
  • Various escape rules

RFC 4180 standardized the format in 2005, but many parsers are lenient.

Required handling:

  1. Field separators
  2. Line endings
  3. Quoted fields (with escaped quotes inside)
  4. Empty fields
  5. Numeric vs string fields (no type info — caller decides)

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…