tsvkit.org
TSV Toolkit
Sample data Say hi →

SQL on a TSV

SELECT · WHERE · GROUP BY · JOIN · subqueries · ⌘/Ctrl + Enter to run

Query a tab-separated file the way you would query a table — no database to start, no import step, no upload. Paste the file, write SQL against the table named tsv, and take the answer away as TSV or JSON. The one thing a spreadsheet cannot do to a 200 MB export, done in the page.

sql
Drop a .tsv file here, or
ready

How to query a TSV with SQL

  1. Paste or drop the file. The line under the drop zone lists the columns it found and how many rows loaded.
  2. Write the query against the table tsv. The alias t works too, so SELECT * FROM t is valid.
  3. Run it with the button or /Ctrl + Enter.
  4. Take it away as TSV or JSON. The table shows the first 200 rows; the download has all of them.

Column names

The header row becomes the column names, verbatim. A name with a space or a punctuation mark in it has to be quoted in SQL the way any database would want — SELECT [order id] FROM tsv or SELECT `order id` FROM tsv. If that gets tiresome, run the file through header tools first and give the columns names you can type. With no header row ticked the columns are called col1, col2 and so on, and every line is data.

Types, and the leading-zero problem

A TSV has no types — every cell is text until something decides otherwise. With detect numbers on, a cell that is exactly a number becomes one, so SUM and ORDER BY behave. A value with a leading zero is deliberately left alone: 007 and 02134 are an order number and a zip code, and turning them into 7 and 2134 loses the thing that makes them identifiers. Turn detection off entirely and every column is text, which is what you want when the file is full of codes and you are only filtering.

What SQL is supported

Enough for real work: SELECT with expressions, WHERE, GROUP BY with HAVING, ORDER BY, LIMIT/OFFSET, DISTINCT, CASE WHEN, the aggregates (COUNT, SUM, AVG, MIN, MAX), string and maths functions, subqueries, UNION, and self-joins:

SELECT a.customer, a.total, b.total AS previous
FROM tsv a JOIN tsv b ON a.customer = b.customer AND b.month = '2026-07'
WHERE a.month = '2026-08' AND a.total > b.total
ORDER BY a.total DESC

The engine is AlaSQL, running in the page. It is not PostgreSQL: window functions, CTEs and recursive queries are not there, and the error messages are terser than you are used to. For grouping without writing SQL at all, group & aggregate does the common cases with menus, and pivot does the cross-tab.

FAQ

Is my file uploaded anywhere?

No. The file is parsed and queried in your browser. The only thing fetched from the network is the SQL engine itself, and after that the page works offline — which is the point of running SQL on an export you are not allowed to upload.

Can I join two different files?

Not in one query here — one file becomes one table. Join two TSV files is the tool for that, and it reports how many rows failed to match, which a SQL join will not tell you unless you ask it twice.

How big a file can it take?

Tens of megabytes are comfortable; past that the limit is your tab's memory, because the whole table is held in it. If a file is too big, slice rows or split it first and query the pieces.

"Parse error on line 1" and the query looks fine.

Check the alias. The engine's grammar reserves more words than you would expect — AS total is a parse error, AS spend is not. Rename the alias, or quote it: AS [total].

Why does SELECT price * 2 give me a text answer?

Because that column was not detected as numeric — usually a thousands separator, a currency symbol or a stray space. Clean numbers strips those, and then detection works.