Skip to content

File formats and references

Supported formats

FormatExtensionsNotes
CSV.csv, .tsv, .txtDelimiter, header and column types are detected automatically.
Parquet.parquetColumnar. The fastest option, and the only one that supports partial reads over HTTP.
JSON.jsonA top-level array of objects, or a single object.
JSON Lines.jsonl, .ndjsonOne JSON object per line.
Excel.xlsxThe first sheet, unless you say otherwise.
Arrow.arrowArrow IPC.

Referring to a file

A file is named by its bare filename, in single quotes, wherever a table would go:

SELECT * FROM 'sales.csv';

Not the full path from your computer — just the name as it appears in the Files panel. Clicking the file in that panel inserts the correct text at your cursor, which is the reliable way to get it right.

Double quotes mean something different in SQL: they quote identifiers, such as a column whose name contains a space.

SELECT "order id", total FROM 'sales.csv';

Remote files

A URL works in the same position:

SELECT * FROM 'https://example.com/data/events.parquet';

For Parquet over HTTP, DuckDB reads the footer, works out which row groups it needs, and fetches only those — provided the host supports range requests and sends Access-Control-Expose-Headers: Content-Range. Without that header the browser will not let DuckDB read the range metadata, and the whole file is downloaded first. The query still succeeds.

Reading several files at once

A glob reads every matching file as one table:

SELECT * FROM 'sales-*.csv';

To know which file a row came from, add the filename as a column:

SELECT * FROM read_csv('sales-*.csv', filename = true);

Overriding detection

When the automatic detection gets it wrong, call the reader function directly instead of naming the file:

-- A file with no header row
SELECT * FROM read_csv('sales.csv', header = false);
-- A semicolon-delimited European export
SELECT * FROM read_csv('sales.csv', delim = ';', decimal_separator = ',');
-- Force a column's type rather than accepting the guess
SELECT * FROM read_csv('sales.csv', types = {'order_id': 'VARCHAR'});
-- A named sheet in a workbook
SELECT * FROM read_xlsx('report.xlsx', sheet = 'Q3');

The full option lists are in the DuckDB documentation for CSV, JSON and Parquet.

Inspecting a file before querying it

To see the columns and types DuckDB inferred, without pulling the data:

DESCRIBE SELECT * FROM 'sales.csv';

And for a statistical summary — min, max, distinct count, null percentage per column — which is the same data the preview’s Columns tab shows:

SUMMARIZE SELECT * FROM 'sales.csv';

Limits

Attached files are held in browser memory, so the practical ceiling is your machine’s available RAM rather than a fixed number. Large remote Parquet files are the exception: a selective query reads only the row groups it needs, so those can be far larger than memory.