How to run SQL on a CSV file
- Drop your CSV on the box above, or choose it from your computer. The first line should hold the column names.
- Check the columns. Each header becomes a lowercase column name (
Order Datebecomesorder_date) and gets a type: number, date or text. - Write a query or click one of the suggested ones, then press Run or Ctrl/⌘ + Enter.
- Export the result as a new CSV file when it looks right.
Private by design
Most "CSV to SQL" sites upload your file to their server. This one can't: the database engine runs inside your browser tab as WebAssembly, so the file is read on your device and the table lives in your tab's memory. Close the tab and it's gone. That makes it safe for customer lists, finance exports and anything else you shouldn't paste into a random website.
Queries to start with
Five patterns cover most questions you'll ask of a spreadsheet export:
SELECT * FROM t LIMIT 10to look at a few rows (Sort and limit).WHEREto keep only matching rows (Filter with WHERE).COUNT(*),SUM()andAVG()to summarise (Count, sum, average).GROUP BYfor one row per category (GROUP BY).JOINto combine two files on a shared id (Your first JOIN).
Stuck on a query? Paste it into the SQL formatter and explainer to see what each part does.
Frequently asked questions
- Is my CSV file uploaded anywhere?
- No. The file is read and turned into a table inside your browser tab, by a database engine compiled to WebAssembly. It never leaves your computer, and closing the tab deletes it. You can even disconnect from the internet after the page loads.
- How big can the CSV be?
- Up to 25 MB and the first 200,000 rows, with up to 100 columns. Bigger files would make the browser tab struggle. Most exports from spreadsheets and BI tools fit easily.
- How are column types detected?
- Every value in a column is checked. Whole numbers become INTEGER, other numbers NUMERIC (REAL in SQLite), YYYY-MM-DD values DATE, values with a time TIMESTAMP, and everything else TEXT. Numbers with leading zeros, like zip codes, stay text so the zeros aren't lost. Empty cells become NULL.
- Can I join two CSV files?
- Yes. Add a second file and it becomes another table next to the first, so you can JOIN them, UNION them or compare them with a subquery.
- PostgreSQL or SQLite?
- Both are real engines: PGlite is PostgreSQL compiled to WebAssembly, and SQLite runs as WebAssembly too. Pick the one you use at work. Switching reloads your files into the other engine.
- Can I use an Excel file?
- Save it as CSV first (File → Save As → CSV in Excel, or File → Download → CSV in Google Sheets), then drop that file here. Semicolon- and tab-separated files work too.