How-To Guide
How to Query CSV with SQL in the Browser
Use SQL on CSV files directly in the browser with DuckDB. Filter, aggregate and inspect local CSV data without uploads or setup.
TL;DR
The simplest way to query CSV with SQL in the browser is to open the file in Queryfiles.app. DuckDB infers the columns and lets you run analytical SQL without installing anything.
Key Takeaways
- --Real SQL, not spreadsheet formulas Use WHERE, GROUP BY, HAVING, CTEs and window functions to inspect CSV data precisely.
- --Automatic column typing DuckDB infers numeric, date and string columns so you can start querying immediately.
- --No upload required The CSV stays in your browser session, which is safer for internal or customer data.
What you need to know
To query a CSV with SQL in the browser, open the file in Queryfiles.app, let DuckDB infer the schema and run standard SQL like SELECT, WHERE, GROUP BY and ORDER BY locally.
CSV is still the most common exchange format for lightweight datasets, but it quickly becomes painful once you need filters, aggregations or repeated checks across multiple columns.
A browser-based SQL workflow is faster than manual spreadsheet work. You keep the file local, write a real query and get deterministic results without importing the data into a remote tool.
Step-by-step workflow
01.Open the CSV in Queryfiles.app
Drag and drop the file into the app. Queryfiles.app recognises CSV and other delimited formats automatically.
02.Let DuckDB infer the schema
Column names and data types are detected for you, which avoids repetitive manual imports or type declarations.
03.Run a baseline SELECT query
Start with a simple preview query so you can confirm the file structure and spot formatting issues early.
04.Add filters and aggregations
Use WHERE to narrow the dataset, GROUP BY for summaries and ORDER BY to rank the results.
05.Refine the query until you answer the business question
Because everything happens locally, you can iterate quickly and inspect results without context switching.
Example browser SQL query for CSV
This kind of query is common when exploring exported transactional data.
SELECT customer_id,
SUM(amount) AS revenue,
COUNT(*) AS orders
FROM data
WHERE order_date >= DATE '2026-01-01'
GROUP BY customer_id
ORDER BY revenue DESC
LIMIT 20;Frequently asked questions
Q.Can I run GROUP BY on a CSV file in the browser?
Yes. Once the CSV is loaded into DuckDB, you can use standard analytical SQL including GROUP BY, HAVING, joins, CTEs and window functions.
Q.Do I need to clean the CSV before opening it?
Not necessarily. Queryfiles.app handles common CSV files directly, and the initial preview query helps you catch parsing issues if the export is messy.
Q.Is querying CSV in the browser fast enough for real work?
For ad hoc inspection and medium-size files, yes. DuckDB WebAssembly is fast enough for many exploratory analytics tasks.
Q.Why not open the CSV in Excel instead?
SQL is better for reproducible filters, aggregations and data validation. It is easier to rerun the same logic than rebuilding formula-based spreadsheet analysis.