# Read a CSV or delimited file

Acquire / file

read CSV, TSV, fixed-width, other delimited text

Page: <https://meridian.online/operations/read-a-csv-or-delimited-file>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

read a CSV with types sniffed

It reads the `orders` table the proofs share. Create it first:

```sql
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);
```

Then run the statement:

```sql
COPY orders TO '<your_scratch_dir>/orders.csv' (HEADER);
CREATE TEMP TABLE result AS
SELECT count(*) AS n, count(amount) AS amounts, any_value(typeof(order_date)) AS date_type FROM read_csv('<your_scratch_dir>/orders.csv');
SELECT * FROM result;
SELECT CASE WHEN ((SELECT n = 10 AND amounts = 9 AND date_type = 'DATE' FROM result)) THEN 'as expected' ELSE error('the CSV did not read back as 10 rows, 9 amounts and a DATE column') END AS verdict;
```

Replace `<your_scratch_dir>` with a directory of your own that you can write to before running the statement.

The statement writes `orders.csv` itself, in `<your_scratch_dir>`.

It needs nothing installed beyond DuckDB itself.

## Variants

- Read delimited text: Read text whose fields are split by a comma, tab, pipe or other separator into rows and columns.
- [Read fixed-width text](https://meridian.online/operations/read-a-csv-or-delimited-file/read-fixed-width-text): Read text whose columns sit at fixed character positions, with no separator between them.
- [Read a file with several record layouts](https://meridian.online/operations/read-a-csv-or-delimited-file/read-a-file-with-several-record-layouts): Read a delimited or fixed-width file whose lines follow different record structures, sending each structure to its own output.
- Split lines with a pattern: Read a text file line by line and cut each line into fields with a regular expression.
- [Load a CSV kept with the project](https://meridian.online/operations/read-a-csv-or-delimited-file/load-a-csv-kept-with-the-project): Load a static CSV file stored alongside the pipeline code into the warehouse as a table.
- [Detect a CSV file's settings](https://meridian.online/operations/read-a-csv-or-delimited-file/detect-a-csv-files-settings): Read the start of a CSV file and report the delimiter, quoting, header and column types it uses.
- Read in batches or as a stream: Read delimited text a batch at a time, or continuously as new data arrives.
- Read each line as one field: Read a text file line by line, keeping each whole line as a single field.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).

- Azure Data Factory: [`Delimited text format (source)`](https://learn.microsoft.com/en-us/azure/data-factory/format-delimited-text) (read 2026-09-27)
- Bruin: [`Seed assets (family)`](https://getbruin.com/docs/bruin/assets/seed.html) (read 2026-09-27)
- Bruin: [`ingestr: csv source`](https://getbruin.com/docs/bruin/ingestion/csv.html) (read 2026-09-27)
- Apache DataFusion: [`CSV`](https://datafusion.apache.org/user-guide/features.html) (read 2026-09-27)
- dbt-utils: [`seed`](https://docs.getdbt.com/docs/build/seeds) (read 2026-09-27)
- DuckDB: `read_csv` (read 2026-09-27)
- DuckDB: `read_csv_auto` (read 2026-09-27)
- DuckDB: `sniff_csv` (read 2026-09-27)
- Duckle: [`CSV`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Fixed-width`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`TSV`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- EasyMorph: [`Import delimited text file`](https://help.easymorph.com/doku.php?id=transformations:importtext) (read 2026-09-27)
- EasyMorph: [`Import fixed width text`](https://help.easymorph.com/doku.php?id=transformations:importfixedwidthtext) (read 2026-09-27)
- AWS Glue: [`CSV (read)`](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-format-csv-home.html) (read 2026-09-27)
- Apache Hop: [`Beam file input`](https://hop.apache.org/manual/latest/pipeline/transforms/beamfileinput.html) (read 2026-09-27)
- Apache Hop: [`CSV file input`](https://hop.apache.org/manual/latest/pipeline/transforms/csvinput.html) (read 2026-09-27)
- Apache Hop: [`Spark file input`](https://hop.apache.org/manual/next/pipeline/transforms/spark-file-input.html) (read 2026-09-27)
- Apache Hop: [`Text File Input`](https://hop.apache.org/manual/latest/pipeline/transforms/textfileinput.html) (read 2026-09-27)
- KNIME Analytics Platform: [`CSV Reader`](https://api.hub.knime.com/nodes/*kquSunBXI2Vo6TJy?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`File Reader (Complex Format)`](https://api.hub.knime.com/nodes/*1gx-wzNlKJPT1Jiv?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Fixed Width File Reader`](https://api.hub.knime.com/nodes/*A0XkYudtYHPfC_2T?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`KNIME Nodes for Wide Data (many columns) (extension)`](https://api.hub.knime.com/extensions/org.knime.features.base.widedata) (read 2026-09-27)
- mlpack: [`ArmaASCII`](https://www.mlpack.org/doc/user/load_save.html) (read 2026-09-27)
- mlpack: [`CSV`](https://www.mlpack.org/doc/user/load_save.html) (read 2026-09-27)
- mlpack: [`RawASCII`](https://www.mlpack.org/doc/user/load_save.html) (read 2026-09-27)
- mlpack: [`TSV`](https://www.mlpack.org/doc/user/load_save.html) (read 2026-09-27)
- Apache NiFi: [`CSVReader`](https://nifi.apache.org/components/org.apache.nifi.csv.CSVReader/) (read 2026-09-27)
- OpenRefine: [`Fixed-width columns`](https://openrefine.org/docs/manual/starting#create-a-project-by-importing-data) (read 2026-09-27)
- OpenRefine: [`comma-separated values (CSV) or text-separated values (TSV)`](https://openrefine.org/docs/manual/starting#create-a-project-by-importing-data) (read 2026-09-27)
- Pentaho Data Integration: [`CSV File Input`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Fixed file input`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`GZIP CSV Input`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Hadoop File Input`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`S3 CSV Input`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Text File Input`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Text file input (deprecated)`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Polars: [`read_clipboard`](https://docs.pola.rs/api/python/stable/reference/io.html) (read 2026-09-27)
- Polars: [`read_csv`](https://docs.pola.rs/api/python/stable/reference/io.html) (read 2026-09-27)
- Polars: [`read_csv_batched`](https://docs.pola.rs/api/python/stable/reference/io.html) (read 2026-09-27)
- Polars: [`scan_csv`](https://docs.pola.rs/api/python/stable/reference/io.html) (read 2026-09-27)
- Power Query M: [`Csv.Document`](https://learn.microsoft.com/en-us/powerquery-m/accessing-data-functions) (read 2026-09-27)
- RapidMiner Studio: [`Read CSV`](https://docs.rapidminer.com/latest/studio/operators/data_access/files/read/read_csv.html) (read 2026-09-27)
- SQLMesh: [`SEED`](https://github.com/SQLMesh/sqlmesh/blob/23b237cea7218cc8f338b89c14f0957394a0003b/docs/concepts/models/model_kinds.md) (read 2026-09-27)
- Talend: [`tFileInputDelimited`](https://help.qlik.com/talend/en-US/components/8.0/delimited/delimited-component) (read 2026-09-27)
- Talend: [`tFileInputFullRow`](https://help.qlik.com/talend/en-US/components/8.0/fullrow/fullrow-component) (read 2026-09-27)
- Talend: [`tFileInputMSDelimited`](https://help.qlik.com/talend/en-US/components/8.0/ms-delimited/ms-delimited-component) (read 2026-09-27)
- Talend: [`tFileInputMSPositional`](https://help.qlik.com/talend/en-US/components/8.0/ms-positional/ms-positional-component) (read 2026-09-27)
- Talend: [`tFileInputPositional`](https://help.qlik.com/talend/en-US/components/8.0/positional/positional-component) (read 2026-09-27)
- Talend: [`tFileInputRegex`](https://help.qlik.com/talend/en-US/components/8.0/regex/regex-component) (read 2026-09-27)
- Talend: [`tFileStreamInputDelimited`](https://help.qlik.com/talend/en-US/components/8.0/delimited/delimited-component) (read 2026-09-27)
- Talend: [`tFileStreamInputFullRow`](https://help.qlik.com/talend/en-US/components/8.0/fullrow/fullrow-component) (read 2026-09-27)
- Talend: [`tFileStreamInputPositional`](https://help.qlik.com/talend/en-US/components/8.0/positional/positional-component) (read 2026-09-27)
- Talend: [`tFileStreamInputRegex`](https://help.qlik.com/talend/en-US/components/8.0/regex/regex-component) (read 2026-09-27)
- VisiData: [`csv (loader)`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/loaders/csv.py#L45) (read 2026-09-23)
- VisiData: [`fixed (loader)`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/loaders/fixed_width.py#L10) (read 2026-09-23)
- VisiData: [`lsv (loader)`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/loaders/lsv.py#L9) (read 2026-09-23)
- VisiData: [`psv (loader)`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/loaders/psv.py#L5) (read 2026-09-23)
- VisiData: [`tsv (loader)`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/loaders/tsv.py#L16) (read 2026-09-23)
- VisiData: [`usv (loader)`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/loaders/usv.py#L5) (read 2026-09-23)
- Yggdrasil Decision Forests: [`csv: (read)`](https://github.com/google/yggdrasil-decision-forests/blob/0a54b57c95ff0cf42ecf0310ace0513a4f32cb65/yggdrasil_decision_forests/dataset/csv_example_reader.h) (read 2026-09-27)
