From a CSV file to a result
The file stays where it is. DuckLocal reads it in place.
Drop the file in
sales.csvbecomes a view calledsales. Tab-separated.tsvfiles,.txtfiles and gzipped.csv.gzfiles work the same way.Write SQL against it
The schema sidebar shows the columns and their inferred types, and autocompletion knows them. Use the full DuckDB SQL dialect: joins, window functions, CTEs and
PIVOT.Keep the answer
Chart the result, look at each column's distribution, or export the complete result to CSV or Parquet.
Join CSV files like tables
Open orders.csv and customers.csv together and each becomes its own view. Join them in one statement, or join a CSV file with a Parquet file, an Excel sheet or a table in a DuckDB database.
SELECT c.region, count(*) AS orders, round(sum(o.amount), 2) AS revenue FROM orders o JOIN customers c USING (customer_id) GROUP BY c.region ORDER BY revenue DESC;
Many files, and messy ones
Read a whole folder of CSV files as one table with read_csv. union_by_name tolerates files whose columns differ. When one stray text value breaks type detection, read everything as text and cast in SQL.
SELECT try_cast(NULLIF(amount, 'NULL') AS DOUBLE) AS amount FROM read_csv('data/*.csv', union_by_name = true, all_varchar = true);
Everything around the query
A query box is the start. These are the parts that make it a workspace.
- .csv .tsv .txtDelimiter, header and types detected by DuckDB
- .csv.gzGzipped files open as data too
- data/*.csvOpen every file that matches a pattern
- folder/Open every data file in a directory
- OverviewNulls, distinct values, range and distribution per column
- ChartsBar, line, scatter, pie and map charts from a result
- Export → ParquetConvert CSV data to Parquet
- ducklocal queryThe same SQL from a terminal, with JSON output
Your CSV never leaves your computer
Online CSV tools need an upload. DuckLocal is a desktop app with DuckDB embedded: it reads the file from its path, does not copy or change it, and needs no account.
Aggregations run over every row of the file. The grid displays up to 100,000 rows of a result, and an export writes the full result.
- No upload and no DuckLocal cloud service
- No database server to install
- No account and no telemetry
- The source file is never modified
- Open source under Apache-2.0
Query CSV from the command line
The same binary runs without a window: ducklocal query --sql "SELECT count(*) FROM 'sales.csv'" prints the result as JSON, for scripts and AI agents.
CSV and SQL questions
- Do I need to import a CSV file into a database first?
- No. DuckLocal creates a view over the file and DuckDB reads it in place. The file is not copied, converted or changed, and removing the view leaves the file untouched.
- Can I join several CSV files in one query?
- Yes. Every file you open becomes its own view, so a
JOINbetween two CSV files is ordinary SQL. You can also join CSV with Parquet, JSON, Excel sheets and DuckDB tables. - Which SQL dialect does DuckLocal use?
- DuckDB SQL, which is close to PostgreSQL and adds analytical features such as window functions,
PIVOT, and reading files directly withread_csv. - What if a column's type is detected wrongly?
- DuckDB infers types from a sample of the file. When a column needs different handling, read it with
read_csv(..., all_varchar = true)and convert it withtry_castin your query. - Can I convert a CSV file to Parquet?
- Yes. Run
SELECT * FROMthe view and choose Export → Parquet. The export reruns the query and writes every row.
Related: Query Excel with SQL · Query JSON with SQL · Local data analysis · Parquet viewer · DuckDB GUI
Run SQL on your own CSV
Download DuckLocal and follow the tutorial with its sample CSV: from file to chart in about ten minutes.