The Scenario
You're the BI engineer responsible for a data governance review, and the task is straightforward on paper: row counts for 12 key tables across three Metabase-connected databases, compiled into a single sheet by end of day. In practice, this means running four queries per database, downloading three CSVs, and stitching them together manually — unless you do it differently.
The bad version:
- Log into Metabase, navigate to the SQL editor, select database 1, run SELECT COUNT(*) FROM table_name for each of the four tables in that database, and note the results.
- Switch to database 2, repeat. Switch to database 3, repeat.
- Open a Google Sheet, create rows for each table, and manually type in the twelve row counts you just noted from three separate browser tabs.
The whole thing takes about 25 minutes when nothing goes wrong. When a query times out on database 3 and you have to reconnect, it takes 45.
The Easy Way: One Prompt in SheetXAI
SheetXAI is an AI agent that lives inside your Google Sheet. It can run SQL against multiple Metabase-connected databases in a single prompt and compile the results into the sheet, no tab-switching required.
List all Metabase databases and write their ID, name, and engine type into Sheet1, then for each database run SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public' and write the table count into column D
What You Get
- Sheet1 has one row per database: ID, name, engine (postgres, mysql, etc.), and the public schema table count.
- All queries run against the live databases — not cached metadata.
- If a database is unreachable, SheetXAI notes the error in column D rather than leaving it blank.
What If the Data Is Not Quite Ready
You're driving the table list from the sheet itself
For each database ID in column A of this sheet, execute the SQL in column B against that Metabase database and write the result row count and first result value into columns C and D
You maintain the query list in the sheet — useful when the 12 tables change from review to review and you don't want to rewrite the prompt each time.
You need engine type and version info alongside the row counts
List all Metabase databases and for each one write name, engine, and database version into columns A through C, then for each database run SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public' and write the count into column D
The governance report gets both the structural metadata and the content stats in one pass.
One database is known to be slow and you want it queried last
Query Metabase databases in this order: database IDs 1, 3, then 2. For each one run SELECT table_name, COUNT(*) as row_count FROM information_schema.tables WHERE table_schema = 'public' GROUP BY table_name and write the results into a tab named after the database
Explicit ordering, separate tabs per database, table-level granularity. The governance doc gets three clean tabs instead of one mixed list.
Full audit with schema comparison in one shot
For each database ID in column A of this sheet, run SELECT table_name, COUNT(*) as row_count FROM information_schema.tables WHERE table_schema = 'public' GROUP BY table_name against that Metabase database, write the results into Sheet1 with a database_id column prepended, then in Sheet2 write one row per database with total table count and total estimated row count
One prompt, two sheets: the detail and the summary. The governance meeting gets both.
Try It
Get the 7-day free trial of SheetXAI and open the Google Sheet for your data governance review, then ask it to query all three Metabase databases and compile the row counts in one pass. Also useful: exporting a Metabase data dictionary into a sheet, and the hub overview on connecting Metabase to Google Sheets.
