guide
Build a dashboard from a CSV with DuckDB-Wasm
Turn a CSV into a linked dashboard in the browser: one SQL query per chart, charts that filter each other, and a link to share. DuckDB-Wasm does the work in the tab.
A dashboard in ducklet is a JSON file that lists charts, and each chart is a SQL query plus a mark (bar, line, map, table…). Because both are plain files, you can write them by hand, have the terminal write them, or ask an AI assistant to, and they are easy to read back.
Start with the data
Open the CSV to chart tool and drop your CSV, or open scratch, which comes with data/campaigns.csv.
One query per chart
-- queries/by_month.sql
SELECT date_trunc('month', date) AS month, sum(amount) AS spent
FROM 'data/spending.csv'
GROUP BY ALL ORDER BY month
-- queries/by_category.sql
SELECT category, sum(amount) AS spent
FROM 'data/spending.csv'
GROUP BY ALL ORDER BY spent DESC
Pin them
chart line queries/by_month.sql
chart barlist queries/by_category.sql --to dashboards/spending.json
The first writes a one-chart dashboard; --to adds a chart as a tile in another. chart link builds a dashboard where brushing one chart filters the rest, with DuckDB re-running the queries as you drag.
Make it read well
Open dashboards/spending.json and give it a title and sections. Add a KPI for the total, controls (a segment, chips, a range) whose values the queries read as $name, and a map if the data has places. Each change re-runs only the queries it touches.
Share it
share dashboards/spending.json gives you a link anyone can open, and share --html a single file that opens offline (see Share a data app). The Household budget app is a finished example: a year of spending by person, category and month.
more guides
- How to query a CSV with SQL in your browser
- How to open a Parquet file without installing anything
- Map live earthquakes with SQL in the browser
- Share a data app as a link, an embed or one HTML file
- How ducklet compares with Datasette Lite, Evidence, Observable and other browser SQL tools
- What each part of ducklet is called elsewhere: Gymnasium, scikit-learn, Optuna, OR-Tools and the rest