Ask your spreadsheets questions in SQL
Filters and pivot tables only get you so far. With SQL you can count, group, join and clean data in a single line, and repeat the same question on next month's file in a second. This free tool turns your CSV, Excel and JSON files into tables you can query with SQL right in your browser. There's nothing to install, no database to set up and no account.
Your data never leaves your computer. The files are read and queried inside this browser tab and are never uploaded, so customer lists, sales exports and other private data stay private. Half a million rows (a 30 MB CSV) load in about two seconds on a typical laptop.
How to query a CSV or Excel file with SQL
- Add your files. Drop CSV, TSV, Excel (.xlsx) or JSON files on the tool, or paste rows copied from Excel or Google Sheets. Each file becomes a table named after the file; each sheet of a workbook becomes its own table.
- Check the columns. Open a table in the sidebar to see its columns and the type detected for each: whole numbers, numbers, dates or text. Click any table or column name to insert it into your query.
- Write a query. Start from the Examples menu, which builds ready-to-run queries from your own columns, or type your own. Suggestions for tables, columns and functions pop up as you type.
- Run it. Press Ctrl + Enter (⌘ + Enter on a Mac). Select part of the text to run just that statement.
- Use the result. Sort by any column, draw a chart, copy it straight into a spreadsheet, download it as CSV, Excel or JSON, or save it as a new table and keep querying.
Want to look around first? Try sample data loads three related tables, customers, products and orders, with a query that joins them.
What you can do with it
- Join files together. Match orders to customers, compare this year's export with last year's, or find rows that appear in one file but not the other.
- Summarize big files. Totals, averages, medians and counts by any column, by month or by week, without building a pivot table.
- Clean data. Find duplicates and empty cells, trim and split text, fix capitalization, extract values with regular expressions, then save the cleaned result as a table.
- Rank and compare. Window functions give you running totals, rankings within groups and changes from the previous row.
- Chart the answer. Switch any result to a bar or line chart, with up to four value columns.
- Work step by step. Run several statements at once, separated by semicolons, and flip between their results. Tables you create stay available until you close the page.
Supported files and how they're read
| File | How it's read |
|---|---|
| CSV, TSV, TXT | The separator (comma, semicolon, tab or pipe) and the header row are detected automatically. Quoted values with commas and line breaks are handled, and files saved in UTF-8, UTF-16 or Windows-1252 encoding are all read correctly. |
| Excel .xlsx / .xlsm | Every visible sheet becomes a table. Dates come through as real dates and formulas as their last calculated values. Leading empty rows and columns are skipped. |
| JSON and JSON lines | An array of records, a file with the records inside a property such as data or items, or one JSON object per line. Nested objects become columns like address.city; lists are kept as JSON text. |
| Pasted data | Rows copied from Excel or Google Sheets (tab-separated), CSV text or JSON. |
Older .xls workbooks, OpenDocument and Numbers files can't be read directly. Save them as .xlsx or CSV first.
Numbers and dates are recognized for you
A column becomes numeric only when every value in it is a number, so a stray "n/a" keeps the column as text instead of losing data. Thousands separators and currency signs are understood in all common styles: 1,234.56, 1.234,56, 1 234,56 and $1,200. Values with leading zeros, such as ZIP codes and product codes, stay text, and so do very long numbers like card or account numbers, so no digits are lost.
Dates are stored in the sortable YYYY-MM-DD form. A column like 03/04/2026 is only converted when the order is certain, for example because another row says 25/04/2026. If every value could be read either way, the column stays text and you choose day/month or month/day in the table's import settings (⚙). The same panel lets you change the separator, the header row and the number style, then re-import in one click.
Example queries
Total sales per region, largest first:
SELECT region, COUNT(*) AS orders, SUM(amount) AS total
FROM sales
GROUP BY region
ORDER BY total DESC;
Monthly revenue from a date column:
SELECT strftime('%Y-%m', order_date) AS month, SUM(amount) AS revenue
FROM sales
GROUP BY month
ORDER BY month;
Customers who never placed an order, using two files:
SELECT c.*
FROM customers AS c
LEFT JOIN orders AS o ON o.customer_id = c.customer_id
WHERE o.customer_id IS NULL;
The three best-selling products in each category:
WITH ranked AS (
SELECT category, product, SUM(qty) AS units,
RANK() OVER (PARTITION BY category ORDER BY SUM(qty) DESC) AS pos
FROM sales
GROUP BY category, product
)
SELECT * FROM ranked WHERE pos <= 3;
Email addresses that appear more than once:
SELECT lower(trim(email)) AS email, COUNT(*) AS copies
FROM contacts
GROUP BY 1
HAVING COUNT(*) > 1;
Which SQL can I use?
The tool understands the SQL you'd write for SQLite, plus handy extras from other databases. Its results are checked against real SQLite with thousands of test queries.
- Queries:
SELECT,DISTINCT,WHERE,GROUP BY,HAVING,ORDER BYwithNULLS FIRST/LAST,LIMITandOFFSET, subqueries,WITH(common table expressions),UNION,INTERSECTandEXCEPT. - Joins: inner, left, right, full and cross joins, with
ONorUSING. - Conditions:
LIKE(not case-sensitive),ILIKE,GLOB,REGEXP,IN,BETWEEN,EXISTS,CASE,IIFandCOALESCE. - Aggregates:
COUNT,SUM,AVG,MIN,MAX,MEDIAN,MODE,QUANTILE,STDDEV,VARIANCE,STRING_AGG,GROUP_CONCAT,ARG_MAXand more, withDISTINCTandFILTER (WHERE …). - Window functions:
ROW_NUMBER,RANK,DENSE_RANK,NTILE,LAG,LEAD,FIRST_VALUE, running sums and moving averages withROWS BETWEENframes. - Dates: SQLite's
date,datetime,strftimeandjulianday, plusyear,month,quarter,week,dayname,date_trunc,date_diff,date_addandINTERVALarithmetic likeorder_date + INTERVAL 30 DAY. - Text:
upper,lower,trim,substr,replace,instr,split_part,lpad,printf,regexp_replace,regexp_extractandjson_extract. - Tables:
CREATE TABLE … AS SELECT,DROP TABLE,SHOW TABLESandDESCRIBE.
INSERT, UPDATE and DELETE aren't available because the tool never changes your files. To change data, create a corrected copy with CREATE TABLE and download that.
Tips for smooth queries
- Names with spaces or symbols go in double quotes:
"Order Date". Clicking a column name in the sidebar adds the quotes for you. - Text values go in single quotes:
WHERE city = 'Paris'. Comparisons with=are case-sensitive,LIKEis not. - Dividing whole numbers gives a decimal result here, so
5 / 2is 2.5. Use5 // 2for whole-number division. - Typos are caught. Misspell a column and the error message suggests the closest name and marks the spot in the editor.
- Format tidies long queries into one clause per line, and the history menu brings back your last 30 queries. History is stored only in this browser, without any of your data.
- Runaway query? A Stop button appears for anything that takes a while, for example a join without an
ONcondition. Your tables are kept.