CSV Reader

Parameters and methods of CSVReader, which reads CSV files into documents.

CSVReader reads data from CSV files.

Parameters

ParameterTypeDefaultDescription
chunking_strategyOptional[ChunkingStrategy]RowChunking()Strategy used to chunk documents

CSVReader also accepts the base Reader constructor parameters.

Methods

read()

Reads a CSV file and returns a list of documents.

ParameterTypeDefaultDescription
fileUnion[Path, str, IO[Any]]RequiredA Path, string path, or binary file-like object such as BytesIO; text-mode handles are not supported
delimiterstr","Character used to separate fields in the CSV
quotecharstr'"'Character used to quote fields in the CSV
nameOptional[str]NoneName override for the resulting documents

async_read()

The async variant of read(). It accepts the same parameters, plus:

ParameterTypeDefaultDescription
page_sizeint1000Number of rows per page when paginating large files