SQL for Excel
Turn the tables in your workbook into a PostgreSQL database. Your AI writes the query with full knowledge of your data model, and the results come back to sheets.
A real database, inside your workbook
Joins across tables, window functions, grouping and filtering: Excel's tables become something you can query properly.
Real PostgreSQL
PostgreSQL runs on your computer through PGlite, in a background worker. Your tables are imported into it when the panel opens.
It reads your data model
It finds every Excel Table, detects keys and relationships from names like customer_id, and draws them for you to check and correct.
Your AI writes the SQL
One click copies a prompt that describes every table, column, key and relationship. The query that comes back runs here, unchanged.
It explains the query
The AI says how the query works, and the app can show PostgreSQL's own execution plan to compare.
Results on sheets
Write a result as a sortable Excel Table on a new sheet, or at the selected cell. Or have a query refresh its results sheet on every run.
Or build it by clicking
Not ready to write SQL? Click columns to build a query, and the SQL appears as you go, with Undo and Redo.
See how your tables fit together
Spreadsheets hold tables without saying how they relate. SQL for Excel works it out, then lets you confirm it.
- Tables, keys and references found for you. Every Excel Table is imported, and
_idcolumns point to the tables they identify. - A diagram you can rearrange. Drag tables around until the picture makes sense to you and your team.
- Remember what you decided. Save the model's types, keys and references on a Metadata sheet in the workbook, so they're read next time and never guessed again.
- Your AI gets the whole picture. The same model goes into the prompt, so joins use the right columns.
Illustration of a data model. In the app, you drag the tables to rearrange them.
Ask, run, understand, report
Each query lives on a tab of its own, and every tab shares the same data.
Ask your AI
Describe what you want to find out, then Copy prompt. It carries your whole model, plus a few sample rows if you allow them.
Run SQL
Paste the reply. The app separates the query from the explanation, and Run executes it. Stop ends a long query.
Results
See the rows, then write them as an Excel Table, at the selected cell, or to a results sheet that refreshes on every run.
Interpretation
Copy a second prompt with the results into the same conversation and paste back a plain-English reading, with the caveats.
Report
Download one HTML page that holds the question, the query, the explanation and the results.
Fix errors fast
If the query fails, Copy a prompt to fix it sends your AI the SQL, the PostgreSQL error and your data model.
-- Running total of revenue by month (window function) SELECT date_trunc('month', o.order_date) AS month, sum(i.quantity * p.price) AS revenue, sum(sum(i.quantity * p.price)) OVER (ORDER BY date_trunc('month', o.order_date)) AS running_total FROM order_items i JOIN orders o USING (order_id) JOIN products p USING (product_id) GROUP BY 1 ORDER BY 1;
The kind of query your AI can write once it knows your model.
Queries that use your tables, not made-up ones
The Examples⦠menu fills in your own table and column names where they fit, and uses a small made-up sales table otherwise, so every example runs.
- Rows in each table
- Top 10 rows
- Totals by group (GROUP BY)
- Join two related tables
- Running total (window function)
Spreadsheet formulas stop being enough when your questions span several tables. SQL is built for that, and with your AI, you don't have to be an expert to use it.
Your database is portable
Save it, share it and bring it back, in the formats other tools already understand.
PostgreSQL files
Download the data as a PostgreSQL .sql file, or load one into new sheets or just for a session.
CSV with a description
Export every table as CSV in one .zip, with a metadata.json that remembers its types, keys and references. Import it back the same way.
Whole-database snapshots
Save and restore everything as a compressed .sql.gz, or as an exact PGlite snapshot.
Tables that exist only in the database can be saved to sheets, and a query tab can open in a window of its own, so you can keep results beside the data.
A big idea in a folder of plain files
SQL for Excel is a JOLT app, with its source open to read and copy.
| File | What it does |
|---|---|
jolt.json | The app's name, version and permissions: it runs in Excel, and may connect to cdn.jsdelivr.net, and nowhere else. |
main.js Β· ui.js | The panel, tabs and every call to Excel, built with VanJS. |
db.js | Runs PostgreSQL (PGlite) in a web worker. |
model.js Β· data.js | Plain functions: finds tables, types, keys and relationships. |
modelview.js Β· diagram.js | The Data model tab and its diagram. |
prompt.js Β· builder.js | The prompts for your AI, and the click-to-build query builder. |
dump.js Β· export.js Β· metadata.js | Database files, CSV export and import, and the Metadata sheet. |
Keep a copy inside a workbook for a course or a client, or publish it once so every workbook uses the same, centrally maintained version.
Install JET, then add the app
Free to install and use, with no fees, ever.
SQL for Excel is a preview. It isn't on the JAM app market yet, so it has no install code. Its source is public, and the code is yours to read, run or adapt.
- Install JET in Excel. It's the runner for every JOLT app.
- Open the app's source on GitHub: availabooks/jolt-apps Β· sql.
- Follow Run from URL or code, or load the folder with JADE or JUICE.
When it's published, you'll install it from JAM with a single code and can review it with your own AI first.
What do I need?
Excel on Windows, Mac or the web, with JET installed. Your tables should be Excel Tables (Insert β Table, or Ctrl+T), so the app can find them.
Does my data leave my computer?
No. PostgreSQL runs inside the add-in. Only what's in the prompt you choose to paste into your AI goes anywhere, and sample rows are optional.
Is it a real PostgreSQL?
It's PGlite, PostgreSQL compiled to WebAssembly. The prompt tells your AI the exact rules of this version, so its SQL runs here without changes.
Will it change my workbook?
Only when you ask it to: results are written to new sheets or the cells you choose. The app can also keep a Metadata sheet if you want the model saved.
Query your spreadsheet like a database.
See what else your own AI can build for Excel.