Run SQL on CSV & Excel Files
Drop your spreadsheets, write SQL, download the answer.
Your files
Or paste cells from a spreadsheet
Tables
No tables yet: add a file, or try the sample files.
Examples
Examples for your tables appear here.
Ctrl+Enter (⌘+Enter) runs the query, or only the selected text.
Result
Run a query to see its result.
About the Run SQL on CSV & Excel Files
Answer questions about your spreadsheets with SQL. Drop CSV, TSV, Excel (.xlsx, .xls), OpenDocument or JSON files: each file — and each sheet of a workbook — becomes a table with its columns typed as numbers or text, so you can filter, GROUP BY, JOIN files on a shared column, and use common table expressions (WITH) and window functions such as RANK() and running totals.
The engine is SQLite, running in your browser (compiled to WebAssembly by the sql.js project): nothing is uploaded. Example queries are written for the tables you load, results appear in a grid, and any result downloads as CSV, Excel or JSON — or keep everything by downloading all the tables as one .sqlite database.
How to use it
- Drop one or more files on the box — CSV, TSV, TXT, Excel (.xlsx, .xls), .ods, JSON or JSON Lines — or paste cells copied from a spreadsheet and press Add as a table. Press Try the sample files for two small tables to practise on.
- Check the Tables list: each table’s name (change it if you like), its rows, and its columns with their types. Under Import options you can say whether the first row holds column names, which decimal mark the files use, and whether text dates written day first or month first should become ISO dates (
YYYY-MM-DD), which sort and compare correctly in SQL. - Write a query in SQL — or pick one of the Examples — and press Run (Ctrl+Enter or ⌘+Enter). Several statements run one after another; the last result with rows is shown.
- Download the result as CSV, Excel or JSON, or copy it into a spreadsheet. Download as .sqlite saves every table, including any you created with
CREATE TABLE … AS SELECT.
Examples
orders.csv: order_id, order_date, region, product, quantity, unit_price
SELECT region, COUNT(*) AS orders,
ROUND(SUM(quantity * unit_price), 2) AS revenue
FROM orders
GROUP BY region
ORDER BY revenue DESC;region orders revenue South 5 273.5 West 4 207.5 North 4 170.25 East 3 149.5
The result on the sample files (Try the sample files).
SELECT c.name, c.city, SUM(o.quantity * o.unit_price) AS spent FROM orders AS o JOIN customers AS c ON c.customer_id = o.customer_id GROUP BY c.customer_id ORDER BY spent DESC LIMIT 5;
name city spent Sofia García Madrid 147 Asha Rao Bengaluru 124.75 Amara Okafor Lagos 114.5 …
A LEFT JOIN … WHERE c.customer_id IS NULL finds orders whose customer is missing from the other file (order 1016 in the sample).
SELECT order_date, quantity * unit_price AS amount,
SUM(quantity * unit_price) OVER (ORDER BY order_date, order_id) AS running_total
FROM orders;Each order with the total of all orders up to it.
Common uses
- Combining two exports — orders and customers, attendance and staff — that share an ID column, without VLOOKUP.
- Summarising a large CSV by month, region or product with GROUP BY instead of a pivot table.
- Finding duplicates, missing values and rows that do not match between two files.
- Practising SQL on your own data, or turning a folder of CSV files into one SQLite database.
How files become tables
- Names: a table is named after its file (
Sales Q1.csv→sales_q1; each sheet of a workbook gets its own table,book_jan). Column names are simplified to lower case with underscores (Order ID→order_id), and names that are SQL keywords get an underscore (order_), so you rarely need quotes. Untick Simplify column names to keep them exactly as written (then quote them:"Order ID"). - Types: a column of whole numbers is INTEGER, of numbers REAL (also with thousands separators, 1,234.50 or 1.234,50), anything else TEXT. Codes stay text so nothing is lost: values with leading zeros (PIN and ZIP codes such as 007 or 01067), a leading + (phone numbers) or more than 18 digits (account numbers). Empty cells are NULL.
- Excel: cells keep the numbers stored in the workbook, TRUE/FALSE become 1 and 0, and date cells become ISO text (
2026-07-01, with the time when there is one), which SQLite’s date functions understand. - JSON: an array of objects (or the first array of objects inside an object, or one object per line) becomes a table with a column per key; nested objects and arrays are kept as JSON text, ready for
json_extract().
SQL that works here
This is SQLite 3.49: SELECT with JOIN (inner, left, right, full and cross), GROUP BY … HAVING, UNION, subqueries, WITH (also recursive), window functions (ROW_NUMBER, RANK, LAG, SUM() OVER…), CASE, string functions (substr, instr, replace, upper, trim, printf), date functions (date, strftime, julianday), JSON functions, and CREATE TABLE … AS SELECT, UPDATE, DELETE and ALTER TABLE on the imported tables. Math and statistics functions include sqrt, power, log (natural), log10, median, stdev and variance. See the SQLite SQL reference for the full language.
Limitations
- Text files up to 100 MB and workbooks up to 50 MB each, and the tables must fit in this page’s memory (a few million cells are fine on most computers).
- Results show the first 2,000 rows on the page; exports of SELECT queries include every row. Excel files hold at most 1,048,575 rows below the header.
- Formulas in workbooks are read as the values last calculated and saved in the file.
- Tables live only while the page is open: download a result or the .sqlite database to keep them.
Privacy
Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot. The SQLite engine (about 650 KB of WebAssembly) is downloaded from this site the first time you load a file; after that it also works offline. Your files and queries are never uploaded.
Frequently asked questions
Can I query an Excel file with SQL?
Yes. Drop the .xlsx (or .xls, .ods) file here: each sheet becomes a table, named after the file (Book1.xlsx → book1), and after the file and the sheet when the workbook has several (book1_sheet2), with numbers and dates read from the cells as they are stored. Then query it like any table, for example SELECT * FROM book1 LIMIT 10.
How do I join two CSV files?
Load both files, then write a JOIN on the column they share: SELECT * FROM orders o JOIN customers c ON c.customer_id = o.customer_id. When both files have the same column name, the Examples list already includes this join and a query for rows without a match.
Why is a column that looks like numbers stored as text?
Because changing it could lose information: leading zeros (PIN, ZIP and product codes), a leading + (phone numbers) and very long digit strings are kept as text. A single non-numeric value (such as “n/a”) also makes the whole column text. Use CAST(column AS REAL) in a query to treat it as a number, or fix the file and load it again.
Which SQL dialect is this?
SQLite. Most everyday SQL is the same as in MySQL, PostgreSQL or SQL Server; the main differences are date functions (strftime('%Y-%m', order_date) instead of DATE_FORMAT), string concatenation with ||, and LIMIT instead of TOP.
Are my files uploaded?
No. The files are read and queried in your browser; nothing about them leaves your device. Only the SQLite engine is downloaded from this site, once. Your queries are kept in this browser’s History list for next time (Clear history removes them); the files and tables are not stored.
Can I keep my tables for later?
Press Download as .sqlite: it saves every table in one SQLite database file, which you can open again in the SQLite Viewer & Editor, DB Browser for SQLite or any SQLite program.