SQL Query on CSV and Excel

Load spreadsheets as tables and ask questions in SQL, with joins across files, GROUP BY totals and one-click export of the answer.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Add files

    Drop CSV, TSV, JSON or XLSX files, or press Load sample tables.

  2. 2
    Check table names

    Rename a table in its box and click column chips to insert names.

  3. 3
    Write the query

    Type a SELECT in the editor or start from a snippet button such as Group and count.

  4. 4
    Run it

    Press Run or Ctrl+Enter and read any error message, which names the problem.

  5. 5
    Reuse a result

    Press Save as table to query the answer again.

  6. 6
    Export

    Download the result as CSV, XLSX with the query on a second sheet, or JSON.

About this tool

Spreadsheets are good at holding data and poor at answering questions about it. Totals per region, the ten largest orders, customers who appear in one export but not in another: each of these takes a pivot table, a helper column or a chain of filters. SQL answers them in one readable sentence. This tool turns every file you open into a database table that lives only in your browser tab. A CSV becomes one table, and every sheet of an Excel workbook becomes its own table, named after the file and the sheet. You then write a SELECT statement, press Ctrl+Enter and see the result as a grid. The query engine is written for this page and runs entirely in JavaScript, so there is no server, no account and no upload. It reads the first non-empty row of each sheet as column names, treats empty cells as NULL, and makes a column numeric when every filled value in it is a plain number, so sums, averages and sorting behave the way you expect. Codes with leading zeros, such as 007 or postcodes, stay as text.

What the engine understands

The supported statement is SELECT with optional DISTINCT, a FROM table with an alias, any number of INNER, LEFT, RIGHT, FULL and CROSS joins, WHERE, GROUP BY, HAVING, ORDER BY with ASC or DESC, LIMIT and OFFSET. Several SELECT statements can be stacked with UNION or UNION ALL. Expressions include arithmetic, text concatenation with two pipe characters, LIKE with percent and underscore wildcards, IN lists, BETWEEN, IS NULL, CASE WHEN and CAST. Aggregates are COUNT, COUNT DISTINCT, SUM, AVG, MIN, MAX, MEDIAN and GROUP_CONCAT. Text helpers include UPPER, LOWER, TRIM, SUBSTR, LEFT, RIGHT, REPLACE and LENGTH, and date helpers YEAR, MONTH, DAY, DATE and YEARMONTH read ISO dates as well as day/month/year dates. GROUP BY and ORDER BY accept a column position such as 1 or an alias from the select list.

Working with several files

Joins are where the tool saves the most time. Open an orders export and a customer list, then write a LEFT JOIN on the shared ID to see which orders have no customer record. Equality joins use a hash index, so tens of thousands of rows on each side finish in well under a second on a laptop. A result can be saved as a new table and queried again, which replaces nested subqueries.

Names with spaces

Column names that contain spaces or punctuation must be quoted with double quotes, square brackets or backticks, for example "Order Date". Clicking a column chip next to a table inserts the name, already quoted when needed, at the cursor. Tables can be renamed in place; the rename can be undone.

Limits

This is a focused SELECT engine, not a full database. It does not support INSERT, UPDATE, DELETE, CREATE, window functions, common table expressions or subqueries inside WHERE; save an intermediate result as a table instead. Old binary XLS files and Parquet are not read, so save them as XLSX or CSV first. Formulas inside a workbook are read as their last saved values. Everything is held in memory, so very large files of several hundred megabytes may be slow or fail on a phone.

Worked example

Two files: sales.csv with 16 orders and reps.csv with each rep's team. The query SELECT r.Team, SUM(s.Revenue) AS rev FROM sales s JOIN reps r ON s.Rep = r.Rep GROUP BY r.Team ORDER BY rev DESC returns Enterprise 12,420 and SMB 9,285. A LEFT JOIN with WHERE r.Team IS NULL then shows the one sale by Fay, who is missing from the rep list, so the totals would otherwise be 450 short.

Quick facts

Frequently asked questions

Are my files uploaded anywhere?

No. Files are read and queried inside your browser tab and disappear when you close it.

Which SQL dialect does it follow?

Standard SELECT syntax close to SQLite and PostgreSQL, with a few spreadsheet helpers such as YEARMONTH.

Why is a column not adding up?

If one cell holds text such as n/a, the column stays text. Use NUMBER(column) or CAST(column AS REAL) in the query.

Can I query two sheets of the same workbook?

Yes. Every sheet becomes its own table, so you can join or union them.

How many rows can it handle?

Hundreds of thousands on a laptop. Joins that would produce more than a million rows are stopped with a message.

Can I keep my queries?

The current query and the last twenty you ran are saved in this browser and listed under History.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages