Back to Metabase in Excel
SheetXAI logo
Metabase logo
Metabase · Excel Guide

Run a Metabase SQL Query and Load Results Into a Excel workbook

2026-05-14
5 min read

The Scenario

It's Thursday afternoon and a request just came in from the finance controller: she needs active subscription data — user IDs, plans, MRR, signup dates — in an Excel workbook before end of day. The data lives in your production database, queryable through Metabase. You have the SQL. But the path from "run the query" to "data in the workbook" involves a CSV download, a file save, an Excel import, and a column header cleanup — every time.

The bad version:

  • Log into Metabase, open the SQL editor, paste in the query, run it, and wait for 2,000 rows.
  • Download the CSV, find it in Downloads under a timestamped filename, open it in Excel.
  • Copy the data, switch to the target workbook, paste it in, and clean up the snake_case headers so they match the controller's preferred format.

Twenty seconds of query time, fifteen minutes of file wrangling. And the controller's follow-up request for a slightly different filter means you do it again.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Excel workbook. It can talk directly to Metabase — running SQL against any connected database and writing the results into your workbook, headers included. No CSV, no import wizard.

Run the native SQL query SELECT user_id, plan, mrr, signup_date FROM subscriptions WHERE status = 'active' against Metabase database ID 3 and write the results into Sheet1 starting at row 1 with column headers

What You Get

  • Row 1 of Sheet1 is populated with column headers: user_id, plan, mrr, signup_date.
  • Every result row lands beneath it, one row per record.
  • The data reflects the current state of the database at the moment the prompt ran.
  • If the query returns zero rows, SheetXAI writes the headers and notes the empty result rather than leaving the workbook blank and ambiguous.

What If the Data Is Not Quite Ready

The column names are in snake_case and the controller wants title case

Run the SQL query SELECT user_id, plan, mrr, signup_date FROM subscriptions WHERE status = 'active' against Metabase database ID 3, write results into Sheet1 starting at row 1, and rename headers to User ID, Plan, MRR, and Signup Date

SheetXAI applies the rename as it writes — no post-paste find-and-replace step required.

You only want rows above a certain MRR threshold

Run the SQL query SELECT user_id, plan, mrr, signup_date FROM subscriptions WHERE status = 'active' AND mrr > 200 against Metabase database ID 3 and write results into Sheet1 with column headers

Push the filter into the SQL. The database applies it before any data reaches the workbook.

The result needs a join against a second worksheet of plan names

Run the SQL query SELECT s.user_id, s.plan_id, s.mrr, p.plan_name FROM subscriptions s JOIN plans p ON s.plan_id = p.id WHERE s.status = 'active' against Metabase database ID 3 and write results into Sheet1 with headers

The join happens in the database. The workbook receives resolved plan names — no VLOOKUP needed.

Full cleanup plus query result in one shot

Run the SQL query SELECT user_id, plan, mrr, signup_date FROM subscriptions WHERE status = 'active' against Metabase database ID 3, write results into Sheet1 with headers renamed to User ID, Plan, MRR, Signup Date, then in column E add a flag that reads MISSING for any row where MRR is blank, otherwise leave it empty

One prompt: the query, the rename, and the data quality column. The workbook arrives analysis-ready.

The pattern: describe the shape you actually need. SheetXAI handles the rest.

Try It

Get the 7-day free trial of SheetXAI and open the Excel workbook where your team pastes subscription exports, then ask it to run the SQL directly against Metabase. Also useful: consolidating multiple Metabase saved questions into one workbook, and the hub overview on connecting Metabase to Excel.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more