About Run SQL on CSV
This tool runs SQL on CSV and Excel files. It is free, needs no sign-up and runs in your browser: the files are read on your device and the database lives in a worker in this tab, so your data is not uploaded. It uses SQLite, compiled to WebAssembly, and the engine file is served from this site rather than from a third-party CDN.
Each file becomes a table named after the file, and each sheet of a workbook becomes its own table. Column types are worked out from the data: whole numbers become INTEGER, other numbers REAL and everything else TEXT, with blank cells stored as NULL. Then write SELECT queries with WHERE, JOIN, GROUP BY, ORDER BY, window functions and common table expressions, using SQLite syntax.
It opens with two sample tables, customers and orders, and a query that joins and sums them. Results appear in a table with paging, and you can download them as CSV.
How to use Run SQL on CSV
- Look at the Tables list to see the sample tables and their columns, or add your own CSV, TSV, XLSX, XLS or ODS files.
- Write a query in the SQL box, using the table and column names shown in the list.
- Press Run, or use Ctrl or Cmd with Enter.
- Read the result table below, move between pages if there are many rows, and download it as CSV.
- Remove a table with the cross, or add more files to join them.
Features
- SQLite running as WebAssembly in a Web Worker, served from this site.
- Several tables at once, so you can join files.
- CSV, TSV, XLSX, XLS and ODS input, one table per file or sheet.
- Column types detected from the data, blank cells stored as NULL.
- Results with paging, and an export of the full result as CSV.
- A time limit on queries, so a runaway query is stopped and your tables are reloaded.
- Clear SQL error messages from the engine.
Worked examples
Which customer spent the most? (sum of orders per customer) gives Grace Hopper, 1388
The sample query joins customers to orders, groups by customer and sorts by the sum. The same total can be checked by adding that customer's orders by hand.
SELECT COUNT(*) FROM orders gives 10
The sample orders table has ten rows.
Column types detected from the data
| If every non-blank cell is | The column becomes | Example |
|---|---|---|
| a whole number | INTEGER | 12, 340, -7 |
| a number, some with decimals | REAL | 18.50, 3.14 |
| a whole number with a leading zero | REAL | 007 (so it is not read as an id) |
| anything else | TEXT | Ada, 2025-01-04 |
Good to know
It is SQLite SQL
The engine is SQLite. It has joins, subqueries, window functions, common table expressions and many built-in functions, but not every function of MySQL, PostgreSQL or SQL Server. Dates are stored as text, so compare them in ISO format (2025-01-31) and use date() and strftime() for date maths.
Limits to know about
The tables live in memory, so very large files use a lot of it; files over 25 MB are refused. A result shows at most 100,000 rows. Changes made with INSERT, UPDATE or DELETE affect only the in-memory copy and are lost when you reload; your original files are never modified.
Privacy: how it works
- Files are read in this browser tab and loaded into an in-memory database that disappears when you close the page. Nothing is uploaded, and the SQL engine file comes from this site, not from a CDN.
Tips
- Table and column names are cleaned to letters, digits and underscores, so "First Name" becomes First_Name.
- Use LIMIT while you are exploring a big table.
- Quote text with single quotes: WHERE country = 'UK'. Double quotes are for names.
- To check a join, count rows before and after. A join on a column with duplicates can multiply rows.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your files and queries are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your files and queries are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
How do I run SQL on a CSV file?
Add the CSV file under Add CSV or XLSX files. It becomes a table named after the file. Write a SELECT query using that table name and press Run.
Which SQL dialect is it?
SQLite. Most standard SQL works, including joins, GROUP BY, window functions and WITH clauses. Functions specific to MySQL, PostgreSQL or SQL Server may not exist.
Can I join two CSV files?
Yes. Add both files, so each becomes a table, then write a JOIN on the columns they share, such as customers.id = orders.customer_id.
Does it work with Excel files?
Yes. XLSX, XLS and ODS files are read in your browser, and every sheet becomes a table named after the file and the sheet.
Is the SQL engine downloaded from a CDN?
No. The WebAssembly file of the engine is served from this site, so there is no third-party request. It is about 700 KB and your browser may cache it.
Why did my query stop?
A query that runs for more than 20 seconds is stopped to keep the page responsive. Add a WHERE or LIMIT, or check for a join that multiplies rows.
Can I save my changes to the CSV?
Your files are never changed. You can export the result of any query as a CSV, including the result of a query that reshapes the data.
How do I convert CSV to JSON?
Use the file converter at /file/converter/data. This tool is for querying tables.
Popular Run SQL on CSV pages
- GROUP BY on a CSVSummarise a CSV file by category with a SQL GROUP BY query.
- Join CSV Files With SQLCombine two files on a shared column, such as an id.
- Filter a CSV With SQLKeep only the rows that meet your conditions.
- Sort a CSV With SQLOrder rows by any column and keep the top few.
- Unique Values in a CSVList each value of a column once.