Google Sheets: How to Pull Data from Google Sheets into Emails
1 Overview
Instead of manually writing JSON, you can connect a Google Spreadsheet as a Data Source. MiN8T reads your spreadsheet via the Google Sheets API, converts the rows into items, and serves them through the same public endpoint used by AMP emails.
This means non-technical team members can update email content by editing a spreadsheet — no JSON knowledge, no code, no deployments. The email fetches the latest data every time it's opened.
The integration uses Google OAuth 2.0 for authorization. MiN8T requests read-only access to your spreadsheets — it can read data but cannot modify, create, or delete your sheets.
Google Sheets is an alternative source type for Data Sources. Everything about endpoints, editor integration, and Smart Elements works identically whether the underlying data comes from JSON or Google Sheets.
2 Preparing Your Spreadsheet
Structure your Google Sheet so MiN8T can convert it to the standard {"items": [...]} format:
Row 1: Column Headers
The first row must contain your field names. These become the mustache variables you use in templates:
| title | url | imgUrl | price | text |
|----------------|--------------------|-----------------------|---------|---------------------------|
| Samsung Galaxy | https://shop.com/s | https://cdn/sam.jpg | $999 | The latest flagship phone |
| iPhone 15 Pro | https://shop.com/i | https://cdn/iph.jpg | $1199 | Pro camera. Pro display. |
| Pixel 9 | https://shop.com/p | https://cdn/pixel.jpg | $899 | AI-first smartphone |
Each subsequent row becomes one item in the data source. The column headers become {{title}}, {{url}}, {{imgUrl}}, {{price}}, and {{text}}.
Best Practices
- Use camelCase or simple names for column headers (e.g.,
imgUrlnotImage URL) - Keep headers in Row 1 — MiN8T always reads the first row as field names
- Use full HTTPS URLs for images and links
- Avoid empty rows in the middle of your data — they create empty items
- If you have multiple tabs, put each data set on its own sheet tab
3 Connecting via OAuth
Step 1: Create a Data Source
In the Data Sources dashboard, click "+ New Source" and enter a name (e.g., "Product Catalog"). Select the "Google Sheets" source type.
Step 2: Sign In with Google
Click "Sign in with Google". A popup window opens with Google's OAuth consent screen.
- Select the Google account that owns (or has access to) the spreadsheet
- Review the permissions — MiN8T requests read-only access to your Google Drive files and Google Sheets data
- Click "Allow"
Step 3: Popup Closes Automatically
After authorization, Google redirects back to MiN8T. The popup window closes automatically and the Data Sources modal transitions to the spreadsheet picker view.
OAuth tokens are encrypted with AES-256-GCM before storage. MiN8T never sees your Google password — only the authorization token that Google provides. Tokens are automatically refreshed when they expire.
Security Details
- The OAuth state parameter is HMAC-signed with SHA-256 to prevent CSRF attacks
- State tokens expire after 10 minutes
- Each state includes a random nonce, user ID, and account ID
- Spreadsheet ID format is validated before any API call (SSRF prevention)
4 Spreadsheet Picker
After OAuth authorization, the modal shows a list of all spreadsheets in your Google Drive.
Search & Sort
- Search bar — filter spreadsheets by name. Type to filter the list in real-time.
- Sort options — alphabetical (A-Z) or most recently modified first
Select a Spreadsheet
Click on a spreadsheet name to select it. If the spreadsheet has multiple tabs (sheets), a second picker appears showing all available sheet tabs.
Select a Sheet Tab
Click on the specific sheet tab that contains your data. MiN8T reads the sheet and displays:
- Spreadsheet name and sheet tab name
- Item count — number of data rows (excluding the header row)
- Field names — column headers discovered from Row 1
- Variables — mustache template variables (
{{title}},{{price}}, etc.)
At this point, MiN8T reads the entire sheet data and stores it as JSON for immediate serving through the Data Source endpoint.
5 Column Headers as Variables
Once connected, your column headers are available as mustache variables throughout the MiN8T editor:
- In the Data tab of the property panel, field names appear as copyable badges
- Use Auto-map to automatically assign fields to text, image, and button blocks
- Manually paste
{{fieldName}}into any block's text, image URL, or button link
The same variables work identically whether the data comes from JSON or Google Sheets. The conversion is transparent — MiN8T normalizes everything to the {"items": [...]} format.
The column header names in your spreadsheet become the exact variable names. A column called imgUrl becomes {{imgUrl}}. A column called Product Name becomes {{Product Name}} (spaces included).
6 Updating Data
When your spreadsheet data changes, the Data Source endpoint will serve the updated content. The update flow:
- Edit your Google Spreadsheet normally (add rows, update prices, change URLs)
- MiN8T re-reads the sheet data when the endpoint is requested and the cache has expired
- Recipients who open your AMP email see the latest data from your spreadsheet
Cache Behavior
The Data Source endpoint caches the response for the configured Cache TTL (default: 5 minutes, range: 60–3600 seconds). This means:
- Updates to your spreadsheet appear in emails after the cache expires
- For time-sensitive content (flash sales, stock levels), reduce the TTL
- For stable content (blog posts, product catalogs), increase the TTL to reduce API calls to Google
Google Sheets API has usage quotas. If your emails generate many concurrent requests, consider setting a longer cache TTL to stay within limits. For very high-volume sends, exporting to JSON may be more reliable.
7 Disconnecting
To revoke MiN8T's access to your Google account:
- Open the Data Source that uses Google Sheets
- Click "Disconnect Google Sheets"
- MiN8T revokes the OAuth token and clears stored credentials
After disconnecting:
- The Data Source retains the last-fetched data as static JSON
- The endpoint continues to serve the cached data
- New data will not be pulled from Google Sheets until you reconnect
- You can reconnect at any time by repeating the OAuth flow
You can also revoke access from Google's side at myaccount.google.com → Security → Third-party apps.
8 Next Steps
Related guides:
- What are Data Sources? — full guide on JSON sources, endpoints, randomizer, and editor integration
- What are Smart Elements? — connect data sources to email elements with auto-mapping
- How to Test and Export AMP Emails — test dynamic content in Gmail
Last updated: April 2026. All details verified against MiN8T's actual codebase implementation.