How to Use SQL in Excel With the SQLOOKUP Add-In
The free SQLOOKUP add-in gives Excel a SQLOOKUP formula that runs a SQL query (SQLite dialect) on a table or range and spills the result into the sheet. You can filter, join and GROUP BY without nested formulas or a pivot. It works in Excel on Windows, Mac and the web, with no Python install.
Install the add-in
SQLOOKUP installs from the Office Add-ins store like any other add-in. On the Home tab, open Add-ins, search for SQLOOKUP and click Add. A SQLookup button then appears at the right end of the Formulas tab and opens the task pane.

SQLOOKUP is not my add-in. Its website describes it as a showcase app for xlwings Wasm, which runs Python inside the add-in itself. In an earlier tutorial I showed how to run SQL queries in Excel with xlwings, but that needed Python on your computer. This one does not.
Formula syntax
The formula takes a query, then pairs of table name and range, and an optional list of date columns. The table name is optional: without it, the first table is called a, the second b, and so on.
=SQLOOKUP(query, [alias a], table a, [alias b], table b, ..., [parse_dates])
- query: the SELECT statement as a string.
- alias: the name the query uses for the range that follows, similar to how LET names values.
- table: a cell range such as
A1:C20or a whole Excel table such asCustomers[#All]. - parse_dates: column names, or parts of names, to treat as dates, comma-separated.
"date"matches order_date, as_of_date and so on.
Empty cells become NULL. Column names with spaces go in square brackets inside the query.
Query a table
A simple filter needs one table: select everything from the customers table where the city is New York. The result spills next to the formula, so leave room below and to the right of it. A #SPILL! error means something is in the way.

For readability, give each table a name instead of a, and spread the query over several lines with Alt+Enter in the formula bar. SQL keywords do not need capitals. I write them that way so the statement is easier to read.

Use a cell as input
To filter by whatever city someone types into G2, build the query string with the ampersand. Close the string before the value, add &G2&, and open it again after. The single quotes around the city stay inside the string, because SQL needs them around text.
=SQLOOKUP(
"SELECT *
FROM customer_table
WHERE city='"&G2&"'",
"customer_table", Customers[#All]
)
Only do this with input you trust. A value containing a single quote breaks the query.
Filter by date
Dates need two things: the date column listed in the last argument, so SQLOOKUP reads it as a date, and SQLite’s datetime() function in the query. This formula returns the orders after 1 July 2024. In my sample data, two orders match.
=SQLOOKUP(
"SELECT *
FROM orders
WHERE order_date > datetime('2024-07-01')",
"orders", Orders[#All],
"date"
)
Because the add-in uses the SQLite dialect, every function in the SQLite documentation is available, including the date and time functions. Functions from other dialects, such as SQL Server’s GETDATE(), do not work.
Join two tables
A join works with two named ranges in one formula. Here the customers table is called c and the orders table o, and an inner join on customer_id returns each order with the customer’s name. The order id column has a space in its name, so it sits in square brackets.
=SQLOOKUP(
"SELECT o.[order id], c.name, o.product, o.amount
FROM c
INNER JOIN o ON c.customer_id = o.customer_id
WHERE c.city IS NOT NULL",
"c", Customers[#All],
"o", Orders[#All]
)
Summarize with GROUP BY
GROUP BY replaces a pivot table or a column of SUMIFS. This query groups the orders by customer and adds a total_spent column with the sum of each customer’s amounts.
=SQLOOKUP(
"SELECT customer_id, SUM(amount) AS total_spent
FROM orders
GROUP BY customer_id",
"orders", Orders[#All]
)
If you think in pandas rather than SQL, the same summary is a groupby, which I compare with the Excel functions in SUMIFS, COUNTIFS and AVERAGEIFS in pandas. To combine SQL queries with Python for reports, see SQL plus Python for data analysis and PDF reports.
Sharing and privacy
Everyone who recalculates the workbook needs the add-in. After I removed it, the old results stayed visible, but the next recalculation turned the cell into a #NAME? error. If you send the file to someone without SQLOOKUP, paste the results as values first.

The queries run locally on your machine. According to the SQLOOKUP privacy policy, no data is sent to an external server and no usage statistics are collected beyond those Microsoft collects for every published add-in.

Resources
- SQLOOKUP website (formula reference and privacy policy)
- SQLite core functions and date and time functions
