API reference

CSV.jl keeps its public namespace small. These names are not exported; use the CSV. prefix.

CSVModule
CSV

Fast, flexible reading and writing of delimited text.

Reading — CSV.File, CSV.read, CSV.lazy, CSV.Rows, CSV.Chunks. Writing — CSV.write, CSV.RowWriter. Diagnostics — CSV.problems, CSV.Problem, CSV.ParseError.

All public names live under the CSV namespace. Reading supports eager, lazy, row-wise, and chunked workflows. Parsing and writing are deterministic for any supported thread count.

source

Eager reading

CSV.FileType
CSV.File(source; keywords...) -> CSV.File

Read delimited data into an eager Tables.jl table. source can be a path or HTTP(S) URL, an IO, a Cmd, bytes, or a vector of sources. CSV.jl detects the delimiter and column types by default. Text uses DataStrings.DataString, pooling is off, and recoverable parse problems are available through CSV.problems. The default on_error=:warn prints one summary warning per read; on_error=:collect records problems silently; on_error=:error (or strict=true) throws a CSV.ParseError at the first problem. Reader keywords control the header and row window, dialect, missing values, types, selected columns, strings, pooling, validation, and task count. ntasks=N bounds parsing to at most N worker tasks, in transpose mode as well.

source
CSV.readFunction
CSV.read(source, sink; keywords...)

Parse with the same options as CSV.File, then call the Tables.jl sink. The new columns are passed as Tables.CopiedColumns, so a sink that honors that marker can take ownership without another copy.

source
CSV.problemsFunction
CSV.problems(file) -> Vector{CSV.Problem}

Return the retained parse problems for a CSV.File, in source order. The parser can retain at most maxproblems entries; the file display reports any additional dropped count. The default on_error=:warn also prints one summary warning per read; use on_error=:collect to record problems silently, or strict=true / on_error=:error to stop at the first parse problem with a CSV.ParseError.

source
CSV.ProblemType
CSV.Problem

One recoverable parse problem, as returned by CSV.problems. Fields: row (1-based data row; 0 for a file- or header-level problem), col (1-based column; 0 for a whole-row problem), pos (byte offset into the parsed bytes), kind, and message. The kinds are :short_row, :long_row, :invalid_value, :invalid_quoted_field, and :unclosed_quote.

source
CSV.ParseErrorType
CSV.ParseError <: Exception

Thrown by the readers under on_error=:error (or strict=true). problem is the source-earliest CSV.Problem in a File or Chunks batch, nproblems counts every problem found, and source labels the input. Rows reports the accessed cell's problem with nproblems=1.

source

Indexed and incremental access

CSV.lazyFunction
CSV.lazy(source; keywords...) -> CSV.LazyFile

Build the quote-aware structural index and return a table whose cells parse when accessed. Column, cell, and Tables.jl column access are supported. CSV.File(lazyfile) performs a full typed parse without repeating the structural scan. This API retains the source bytes and index; it does not stream an unbounded input. List selection uses stable file order and removes duplicates. A later CSV.File(lazyfile) retains those visible columns and can only project them further. Ordinary text cells are zero-copy views. A long cell whose absolute source offset cannot fit the compact view word copies only that cell into a bounded backing buffer.

source
CSV.LazyFileType
CSV.LazyFile

The indexed table that CSV.lazy returns. It holds the source bytes and the structural index, and no parsed values. names(lf), size(lf), and Tables.columnnames come from the index. lf.name and lf[:name] return a column view whose cells parse when read; lf.name[i] parses one cell. Every cell is DataString or missing unless types requested a type for its column. A view keeps the source alive, so a LazyFile is a way to look before parsing, not a way to hold a large file cheaply. CSV.File(lf) runs the eager typed parse on the existing index and keeps the columns lf selected.

source
CSV.RowsType
CSV.Rows(source; types=nothing, stringtype=DataStrings.DataString, keywords...)

Iterate lightweight Tables.jl row views without allocating eager columns. Cells materialize on access. The source bytes and complete structural index remain in memory, so length(rows) and names(rows) are known before iteration. reusebuffer is accepted but is inert because the row view has no per-row value buffer. Invalid or malformed cells become missing by default; strict=true or on_error=:error throws a CSV.ParseError when the cell is accessed. Rows do not retain parse diagnostics, so use CSV.File when CSV.problems or a diagnostic cap is needed. select and drop (a list, one name, or a Regex) project columns in stable file order.

source
CSV.ChunksType
CSV.Chunks(source; ntasks=Threads.nthreads(), keywords...)

Iterate a source as stable-schema CSV.File batches and provide the Tables.jl partitions interface. Every batch has the same column types, including one settled width for an auto-width string request such as stringtype=InlineString. Pooling is evaluated per batch. ntasks sets the target batch count; use chunkbytes for direct size control. List select and drop forms project every batch in stable file order. With the default on_error=:warn, the first batch with parse problems prints one summary warning; every batch keeps its own CSV.problems.

source

Writing

CSV.writeFunction
CSV.write(sink, table; keywords...)

Write any Tables.jl table as delimited text to a path or IO. The writer supports header control (writeheader, header), append mode, gzip (compress), partitioned sinks (partition), quote styles (quotestyle, quotestrings), dialect bytes (delim of any length, quotechar, openquotechar/closequotechar, escapechar, newline, decimal, missingstring, bom), number and date formats (floatformat, dateformat), cell transforms (transform), a rendered-row size bound (bufsize), task count (ntasks), and deterministic ordered output. Column-access tables can render row blocks in parallel. Row-access sources and CSV.Chunks stream without being collected. An IO sink is written at its current position and never rewound or truncated. A partitioned string base path returns the generated path vector; other forms return the supplied sink. CSV.write(sink; keywords...) returns a function of the table, for table |> CSV.write(path).

source
CSV.RowWriterType
CSV.RowWriter(table; keywords...)

Iterate complete CSV-formatted row strings. The header is first unless it is disabled. Rows render on demand with the same dialect and value formatting as CSV.write. With the same formatting options, joining the iterator gives the same uncompressed bytes as CSV.write.

source

Text values

Text values and mutable string columns come from DataStrings.jl. Use DataStrings.DataString and DataStrings.StringVector for their APIs.