Run SQL queries on a CSV file
Load a CSV and query it as a table called csv. It's real SQLite running in your browser, so GROUP BY, CASE, subqueries and window functions all work, with no database to install.
Free. No sign-up. Opens with a sample GROUP BY query you can edit.
How it works
-
Load your CSV
Drop a file on the Open file step. Its header row becomes the column names of a table you query as
csv. -
Write a query in a Custom SQL step
The sample first adds an
age_groupcolumn with a Calculate step, then a Custom SQL step runsGROUP BY age_group, regionwithAVG(income)andCOUNT(*). -
Chain or export the result
The result is a new table. Add another step below it to keep going, or export it as CSV, Excel or HTML.
Why CSV Notebook
-
Private
Runs in your browser. Your files are never uploaded, so nobody else can see them.
-
Repeatable
No AI and no guesswork: the same steps on the same file give the same result every time. Your steps are saved as a notebook in your browser. Next month, open it and drop in the new file: if a column was renamed, the step that needs it stops with an error that names it, and Pro can map it for you.
-
Auditable
Every transformation step is SQL you can read, so you can check exactly what happened to your data. Each step also shows a preview of its output and a summary of what it did, so you can see the result before you export.
Worked example
| tract_id | region | age | income |
|---|---|---|---|
| 1001 | North | 25 | 55000 |
| 1001 | North | 45 | 120000 |
| 1002 | South | 15 | 0 |
| 1002 | South | 42 | 75000 |
| 1003 | North | 70 | 62000 |
| 1003 | North | 68 | 60000 |
| 1004 | West | 30 | 88000 |
| 1004 | West | 35 | 95000 |
| age_group | region | avg_income | count |
|---|---|---|---|
| 18-29 | North | 55000 | 1 |
| 30-49 | North | 120000 | 1 |
| 30-49 | South | 75000 | 1 |
| 30-49 | West | 91500 | 2 |
| 65+ | North | 61000 | 2 |
| Under 18 | South | 0 | 1 |
The query is SELECT age_group, region, AVG(csvn_num(income)) AS avg_income, COUNT(*) AS count FROM csv GROUP BY age_group, region ORDER BY age_group, region; Change it, and the result updates when you run the step.
Edit the sample query
The notebook opens with census sample data and a GROUP BY query. Rewrite the SQL, or drop in your own CSV and start from SELECT * FROM csv.
Frequently asked questions
Which SQL dialect does it use?
SQLite 3.45, compiled to WebAssembly (sql.js). You get the usual SQLite functions such as strftime, ROUND, COALESCE and CASE, plus window functions like ROW_NUMBER() OVER (...).
How do I compare numbers safely?
CSV Notebook stores every value as the exact text in your file, so a ZIP code like 02134 never loses its zero. A comparison such as age < 30 can then compare text, where '9' sorts after '30'. SQL's CAST(age AS INTEGER) fixes that but turns a blank or abc into 0. Use csvn_num(age) instead: it gives the number, or nothing for anything that isn't a plain number. The sample does this, so a missing age lands in Unknown rather than Under 18.
Can I start my query with WITH?
Not at the very start: the Custom SQL step already wraps your query as WITH csv AS (...). Use a subquery in FROM (...) instead, which works the same way.
Can I query two CSV files together?
Load the second file with a Join step first. The Custom SQL step below it then sees the joined result as csv. See joining CSV files for how the Join step works.
Is my data sent to a server?
No. The database lives in your browser's memory and is rebuilt from your file each time you open the notebook. Your queries and results never leave your computer.