Skip to content

SQL on CSV: Query a File Like a Table

Drop a CSV or Excel file and query it with SQL as a table named data; nothing is uploaded.

Processed on your device. Nothing is uploadedHow to check

Try a sample file:

You can also paste CSV or JSON text with Ctrl+V (⌘+V on a Mac).

Your file is opened in this browser tab only: it is never uploaded or stored anywhere, and it is gone when you close the tab.

  • CSVView and edit.csv.tsv.tab.xlsx.xls.xlsm.ods
Paste text instead

Pasted text stays in this tab and is never sent anywhere.

Run SQL on a CSV file in your browser: the file is loaded into a SQL engine on your device as a table named data, and you write SELECT queries with WHERE, GROUP BY, ORDER BY, aggregates and joins of the table with itself. Results appear in a grid and download as CSV or Excel. Excel files open their first sheet. Nothing is uploaded.

Why use SQL on CSV

  • Private

    Your file is opened by your own browser and never sent to a server, so nobody else sees it.

  • Real SQL

    Queries run in a SQL engine inside the page, so standard SQL works: SELECT, WHERE, GROUP BY, ORDER BY, JOIN and aggregates.

  • Works offline

    After you have used it once, it keeps working without an internet connection.

How it works: run SQL on a CSV file

  1. Open your file

    Drop a CSV or Excel file, choose it, paste CSV into the paste box, or try one of the samples.

  2. Write a query

    Query the table named data, for example SELECT city, COUNT(*) FROM data GROUP BY city.

  3. Read the results

    The result appears in a grid under the query; change the query and run it again as often as you like.

  4. Download the result

    Save the result as a CSV or Excel file.

What SQL on CSV handles

  • Input: CSV files, and Excel .xlsx and .xls files (the first sheet).
  • Table: one table per file, named data.
  • Queries: SELECT with WHERE, GROUP BY, ORDER BY, aggregates and joins of data with itself (standard SQL, run in your browser).
  • Types: columns of numbers are stored as REAL, so sums and comparisons work on numbers.
  • Results: shown in a grid, downloadable as CSV or Excel.

SQL on CSV: what it can't do

  • One table per file; two files can't be joined.
  • Standard SQL only; extensions specific to one database may not work.
  • Excel files: only the first sheet is loaded.

SQL on CSV: questions and answers

Is my file uploaded?
No. The file is loaded into a SQL engine inside your browser, and queries run on your device; nothing is sent to a server.
What is the table called?
data. Write queries such as SELECT * FROM data WHERE amount > 100 ORDER BY amount DESC.
Which SQL dialect is used?
Standard SQL, run by a SQL engine in your browser. SELECT, WHERE, GROUP BY, ORDER BY, aggregates such as COUNT, SUM and AVG, and joins of the table with itself all work.
Can I join two CSV files?
No. Each file is one table named data, so joins are only of that table with itself.
Can I query an Excel file?
Yes. Its first sheet is loaded as the table data.
How are number columns typed?
A column of numbers is stored as REAL, so SUM, AVG and comparisons such as amount > 100 treat its values as numbers, not text.
How do I query a CSV file with SQL?
Load the CSV into a SQL engine as a table and run SELECT queries on it, the same way you would query a database. In OpenAnyDoc, open the CSV and write a query such as SELECT * FROM data WHERE amount > 100; it runs in your browser without uploading the file, and the results download as CSV or Excel.

Why it's private: your files never leave your browser

Most online viewers upload your file to a server, so a copy of it leaves your device. OpenAnyDoc works the other way round: your browser reads the file and draws it on your screen. Nothing is uploaded, there is no account, and the file is gone from memory when you close the tab, so there is nothing for us to store, see or lose.

How we tell you about new features

Announcements are based on the release date shown to everyone, and nothing is stored on your device or sent anywhere.