How to send Metabase results to Google Sheets automatically
Metabase can import Google Sheets, but it can't push a question's results back out to a Sheet on a schedule. Here's the manual way, and a free script that does it for you every hour or every morning.
The manual way (fine for once in a while)
The automatic way (free, about 5 minutes)
SheetRefresh is a small open-source script that lives inside your Google Sheet. Set it up once:
- Create a Metabase API key. In Metabase: Admin → Settings → Authentication → API Keys → Create. Give it a group that can only see the questions this Sheet needs.
- Make your own copy of the SheetRefresh Sheet. Click the button, then Make a copy. It lands in your Google Drive with the script already inside. Nobody else can see your copy.
- Open your copy. After a few seconds a SheetRefresh menu appears next to Help.
- Connect to Metabase. Click SheetRefresh → Connect to Metabase. Google asks you to approve access the first time. Because the script is your own copy, Google shows a "Google hasn't verified this app" screen: click Advanced → Go to SheetRefresh (unsafe), then Allow. The developer email on that screen is your own, because your copy belongs to you. Then enter your Metabase address and the API key.
- Add a question. Click SheetRefresh → Add a question, paste a question link (like
https://yourcompany.metabaseapp.com/question/123), and name the tab it should fill. - Refresh and schedule. Click SheetRefresh → Refresh all now to check it works, then Refresh every hour or Refresh every morning. It keeps running with your browser closed.
Want it in a Sheet you already have? Paste the script in yourself
- Open that Sheet and click Extensions → Apps Script. A code editor opens in a new tab.
-
Click the button below, then in the editor select everything in
Code.gs, paste over it, and click the Save icon. - Reload the Sheet so the SheetRefresh menu appears, then follow steps 4–6 above. On Google's warning screen, the link says Go to Untitled project (unsafe) instead.
Prefer to read the code first? It's all on GitHub.
Why it works where other scripts break
- Works with SSO. It uses a Metabase API key, not a username and password, so Google/Okta sign-in doesn't break it.
- Nothing to host. It runs on Google's own scheduler. No server, no Zapier task limits, no monthly bill.
- Your data stays yours. Results go straight from your Metabase to your Sheet. There's no middleman server.
- Refreshes in place. Charts, formulas and pivot tables that point at the tab keep working.
Questions
What do I need?
A Metabase with API keys (Admin → Settings → Authentication → API Keys) that Google's servers can reach over the internet — Metabase Cloud, or self-hosted on a public address. Plus a Google account with Google Sheets.
My Metabase is behind a VPN or firewall. Will it work?
No. Google's servers make the request, so they need to reach your Metabase.
Is it really free?
Yes. The script is open source under the MIT license. If it saves you time, you can buy me a coffee, but you don't have to.
Where is my API key stored?
In your own Google account (Apps Script user properties), not in the Sheet's cells. Other editors of the Sheet don't see it, and the schedule runs as you.
How big can a refresh be?
Google Sheets holds up to 10 million cells per spreadsheet. It's built for reporting-sized results, not full table dumps.
Will there be a paid version?
Maybe: a one-click install, email alerts when a refresh fails, and filter values per question. The free script stays free. Email me if you want to hear when it's ready.
Questions or stuck?
Saved you a Monday-morning CSV shuffle?
☕ Buy me a coffee