Back to Metabase in Google Sheets
SheetXAI logo
Metabase logo
Metabase · Google Sheets Guide

Run a Metabase Pivot Query and Load the Cross-Tab Into a Google Sheet

2026-05-14
5 min read

The Scenario

The monthly finance pack is due Friday. One of its core tables is MRR by plan tier broken down by month — Starter, Pro, Enterprise as columns, January through December as rows. You have a Metabase saved question that holds the underlying data, but it returns flat rows. Turning it into a cross-tab requires either a pivot table in the sheet or a pivot query in Metabase. The finance team wants it as a clean cross-tab, not a flat table with a pivot layer on top.

The bad version:

  • Open Metabase, find the relevant card, and attempt to run a pivot using the Metabase visualization settings — only to find that the pivot visualization doesn't export cleanly to CSV.
  • Export the flat data instead, paste it into the sheet, and manually build a pivot table using Google Sheets' native pivot feature.
  • Format the pivot table so it looks like a static table (the finance team has asked for static tables, not pivot tables that shift when the data changes).
  • Repeat this next month.

The manual pivot is four steps, each of which can fail in a different way, and the finance team's request for "static tables" means you can't just set it and forget it — you rebuild it every month.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Google Sheet. It can execute a Metabase pivot dataset query and write the cross-tabulated results directly into the sheet — plans as columns, months as rows, MRR as values.

Run a pivot query on Metabase card ID 88 that pivots by plan_tier as columns and month as rows with total_mrr as the value, then write the pivot table into this sheet starting at A1 with headers

What You Get

  • A static cross-tab table in the sheet: months in column A, plan tiers (Starter, Pro, Enterprise) as column headers in row 1, MRR values in the intersecting cells.
  • No pivot table layer — the data sits in cells directly, so the finance team can style and reference it like any other range.
  • Totals row not included by default — ask for it in the prompt if you want it.

What If the Data Is Not Quite Ready

The plan tier names in Metabase don't match what finance uses

Run a pivot query on Metabase card ID 88 pivoting by plan_tier as columns and month as rows with total_mrr as values, rename the column headers from starter to Starter Plan, pro to Pro Plan, and enterprise to Enterprise Plan, and write the result into this sheet starting at A1

The headers land with the finance-friendly labels rather than the database enum values.

You want the pivot against a raw SQL query instead of a saved card

Execute a Metabase pivot dataset query against database ID 2 with breakout by region and product, metric as total_revenue, and write the resulting pivot table into this sheet with regions as rows and products as columns

Works the same way for a native SQL pivot — specify the database ID and the breakout dimensions rather than a card ID.

The month column is stored as a raw timestamp and needs formatting

Run a pivot query on Metabase card ID 88 pivoting by plan_tier as columns and month as rows with total_mrr as values, format the month column as MMM YYYY (e.g., Jan 2026), and write the result into this sheet

The month column arrives in the format the finance pack uses — no post-paste formatting step.

Full finance pack table in one shot

Run a pivot query on Metabase card ID 88 pivoting by plan_tier as columns and month as rows with total_mrr as values. Format months as MMM YYYY. Rename headers to Starter Plan, Pro Plan, Enterprise Plan. Add a Total column that sums across the three plan tiers. Write everything into this sheet starting at A1 with all headers.

One prompt, one table, finance-ready. The monthly rebuild takes less than a minute.

Try It

Get the 7-day free trial of SheetXAI and open the Google Sheet you use for the monthly finance pack, then ask it to run the Metabase pivot and write the cross-tab directly. Also useful: pulling Metabase saved question results into a sheet, and the hub overview on connecting Metabase to Google Sheets.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more