Query any CSV file with SQL directly inside VS Code. Open a panel that previews the file, lets you write SQL against it, and shows results in a sortable, filterable, groupable table.
Features
- Preview any CSV — opens the file and shows the first 50 rows in a clean table.
- Run SQL queries — full SQL via alasql. The CSV is exposed as a table named
csv. - Suggested queries — the extension inspects your headers and column cardinality on load and proposes useful queries (list IDs, count by column, filter by value, find empty cells, and more).
- Sortable, filterable results — click any column header to sort. Filter results globally or per-column.
- Group with drill-down — group results by any column to see counts, then expand any group to see the underlying rows.
- Table or raw CSV view — toggle between a formatted table and raw CSV output of the current results.
Usage
- Open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P). - Run CSV Query: Open Query Panel.
- Pick a CSV file when prompted.
- Type a SQL query (or pick one from the 💡 Suggest dropdown) and press
Cmd+Enter/Ctrl+Enter.
Example queries
-- Top 100 rows
SELECT * FROM csv LIMIT 100
-- Filter by a list of IDs (wrap column names with spaces in backticks)
SELECT * FROM csv WHERE `Person Number` IN (1234, 5678, 91011)
-- Group and count
SELECT State, COUNT(*) AS cnt FROM csv GROUP BY State ORDER BY cnt DESC
-- Substring match
SELECT * FROM csv WHERE Email LIKE '%@kleenXServices.org%'