SQL Query Tool — Run SQL on CSV, Excel & JSON Files Online

Free online SQL tool for CSV, Excel and JSON files. Drop in your files and query them like database tables: filter, group, join several files, use window functions and dates, then chart the result or download it as CSV, Excel or JSON. Smart type detection, autocomplete and examples built from your own columns. Your data never leaves your browser.

Developer Tools Client-Side · Free · No sign-up
Drop CSV, Excel or JSON files here Each file becomes a table you can query with SQL. Add several to join them.
CSVTSVExcel .xlsxJSONJSON lines
🔒 Files are read in your browser. Nothing is uploaded.

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

  1. 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.
  2. 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.
  3. 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.
  4. Run it. Press Ctrl + Enter (⌘ + Enter on a Mac). Select part of the text to run just that statement.
  5. 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

FileHow it's read
CSV, TSV, TXTThe 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 / .xlsmEvery 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 linesAn 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 dataRows 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 BY with NULLS FIRST/LAST, LIMIT and OFFSET, subqueries, WITH (common table expressions), UNION, INTERSECT and EXCEPT.
  • Joins: inner, left, right, full and cross joins, with ON or USING.
  • Conditions: LIKE (not case-sensitive), ILIKE, GLOB, REGEXP, IN, BETWEEN, EXISTS, CASE, IIF and COALESCE.
  • Aggregates: COUNT, SUM, AVG, MIN, MAX, MEDIAN, MODE, QUANTILE, STDDEV, VARIANCE, STRING_AGG, GROUP_CONCAT, ARG_MAX and more, with DISTINCT and FILTER (WHERE …).
  • Window functions: ROW_NUMBER, RANK, DENSE_RANK, NTILE, LAG, LEAD, FIRST_VALUE, running sums and moving averages with ROWS BETWEEN frames.
  • Dates: SQLite's date, datetime, strftime and julianday, plus year, month, quarter, week, dayname, date_trunc, date_diff, date_add and INTERVAL arithmetic like order_date + INTERVAL 30 DAY.
  • Text: upper, lower, trim, substr, replace, instr, split_part, lpad, printf, regexp_replace, regexp_extract and json_extract.
  • Tables: CREATE TABLE … AS SELECT, DROP TABLE, SHOW TABLES and DESCRIBE.

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, LIKE is not.
  • Dividing whole numbers gives a decimal result here, so 5 / 2 is 2.5. Use 5 // 2 for 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 ON condition. Your tables are kept.

Frequently Asked Questions

Are my files uploaded to a server?

No. Your files are opened and queried inside this browser tab, and nothing is sent anywhere. There's no account and nothing is saved on a server: when you close the tab, the tables are gone. Only your recent query texts are remembered in this browser so the history menu works, never your data.

Do I need to install a database or create an account?

No. The SQL engine is built into the page, so it works in any modern browser on Windows, Mac, Linux, ChromeOS and tablets. Open the page, add a file and start writing queries.

How do I query an Excel file with SQL?

Drop the .xlsx file on the tool. Every visible sheet becomes its own table, named after the file and the sheet, for example sales_q3. Click the table to see its columns, then run a query such as SELECT * FROM sales_q3 LIMIT 100. For older .xls files, save them as .xlsx or CSV in Excel or LibreOffice first.

Can I join two CSV files?

Yes. Add both files and join them like database tables, for example SELECT * FROM orders o JOIN customers c ON c.customer_id = o.customer_id. Inner, left, right, full and cross joins all work, and you can join CSV, Excel and JSON tables with each other.

How large can my files be?

Files with hundreds of thousands to a few million rows work well. A 30 MB CSV with half a million rows loads in about two seconds, and typical group-by queries on it finish in under a second. The practical limit is your device's memory, so very large files work best on a computer rather than a phone.

Which SQL dialect does it use?

SQLite's syntax and functions, extended with popular extras such as MEDIAN, STRING_AGG, FILTER (WHERE …), date_trunc, date_diff, INTERVAL arithmetic, ILIKE and regular expressions. If you know SQLite, MySQL, PostgreSQL or DuckDB, the queries will feel familiar.

Why is my column treated as text instead of numbers?

A column is numeric only when every non-empty value in it is a number. One value like "n/a", "-" or "12 pcs" keeps the whole column as text so nothing is lost. You can still calculate with it, for example CAST(price AS REAL), or clean it with replace() and save the result as a new table.

My file uses commas as decimal separators. Will that work?

Yes. Numbers like 1.234,56 and 12,5 are recognized, which is common in semicolon-separated files from European versions of Excel. If a column is read the wrong way, open the table's import settings (⚙), choose the number style and re-import.

How are dates handled?

Dates are converted to the YYYY-MM-DD format, which sorts correctly and works with all date functions. Dates written with slashes, like 03/04/2026, are only converted when it's clear whether the day or the month comes first. Otherwise you choose day/month/year or month/day/year in the import settings.

Can I change or delete rows in my file?

The tool never changes your original files, so INSERT, UPDATE and DELETE aren't available. Instead, build the corrected data with a query, save it with CREATE TABLE new_name AS SELECT … or the Save as table button, and download it as CSV or Excel.

How do I export query results to Excel?

Press Excel above the results to download an .xlsx file with a frozen header row and filters, or press Copy and paste straight into Excel or Google Sheets. CSV and JSON downloads are also available. Exports include every row of the result, in the sort order you've chosen.

How do I refer to a column whose name has spaces?

Put it in double quotes, like SELECT "Order Date" FROM sales. Text values use single quotes instead: WHERE city = 'Paris'. Clicking a column name in the sidebar inserts it with the right quotes.

What happens if a query takes too long?

A Stop button appears next to Run. Stopping cancels the query immediately and keeps all your tables, including the ones you created with CREATE TABLE or Save as table.

Does it work with JSON files from an API?

Yes. The tool finds the list of records even when it's wrapped in a property such as data, items or results, and turns nested objects into columns like customer.name. Newline-delimited JSON (JSON lines) works too.

🔄 Changelog

v1.0 (November 2026) - First release: query CSV, TSV, Excel (.xlsx) and JSON files with SQL in the browser, no upload - SQLite-compatible SQL with joins, CTEs, window functions, date functions, INTERVAL, MEDIAN, STRING_AGG and FILTER - Automatic separator, header, number style and date detection with per-table import settings - Editor with highlighting, autocomplete, error markers, formatter, history and examples built from your columns - Sortable results, bar and line charts, copy, CSV, Excel and JSON export, save result as table - Stop button for long queries, sample data with three related tables

See all Developer Tools →

Rate this tool

No ratings yet — be the first.

Click a star to rate this tool.

Was this tool helpful?

Comments

No comments yet. Be the first to share your thoughts!

Leave a Comment

Share this tool

📚 Related Articles

Stay Updated

Subscribe to our newsletter and get notified when we add new tools.