Google Sheets
The Google Sheets integration appends form submissions as rows in a Google Spreadsheet. It uses OAuth 2.0 for authentication and Google Drive Picker for spreadsheet selection.
Features
- OAuth 2.0 authentication with automatic token refresh
- Google Drive Picker popup for visual spreadsheet selection
- Checkbox-based field selection (choose which fields to send)
- Metadata fields: Submission ID, Date, IP Address, User Agent
Setup
Google Cloud Console
- Create a project at Google Cloud Console
- Enable these APIs:
- Google Sheets API
- Google Drive API
- Google Picker API
- Create an OAuth 2.0 Client ID (Web application)
- Create an API Key and restrict it to Google Picker API
- Add your redirect URI to authorized redirect URIs
Environment Variables
FILAFORMS_GOOGLE_SHEETS_ENABLED=true
FILAFORMS_GOOGLE_CLIENT_ID=your-id.apps.googleusercontent.com
FILAFORMS_GOOGLE_CLIENT_SECRET=your-secret
FILAFORMS_GOOGLE_API_KEY=your-api-key
Redirect URI
Register this exact URL in Google Cloud Console:
Production:
https://your-domain.com/filaforms/connections/oauth/callback
Local development (with fwd.host):
https://fwd.host/http://your-site.test/filaforms/connections/oauth/callback
For local development, also set:
FILAFORMS_OAUTH_CALLBACK_URL=https://fwd.host/http://your-site.test/filaforms/connections/oauth/callback
User Flow
- Admin connects a Google account on the Integrations page (OAuth)
- On a form's integration settings, adds a Google Sheets integration
- Selects the connected Google account from the dropdown
- Clicks Select a Google Spreadsheet to open the Drive Picker popup
- Picks a spreadsheet from the popup -- selection is saved via
postMessage, popup closes automatically - Enters the sheet tab name (defaults to "Sheet1")
- Selects which form fields and metadata to include via checkboxes
- On form submission, data appends as a new row in the spreadsheet
OAuth Scopes
The integration requests these Google OAuth scopes:
https://www.googleapis.com/auth/spreadsheets-- Read/write spreadsheet datahttps://www.googleapis.com/auth/drive.readonly-- Browse spreadsheets in Drive Pickerhttps://www.googleapis.com/auth/userinfo.email-- Display connected account email
Routes
| Method | URI | Purpose |
|---|---|---|
GET | /filaforms/connections/oauth/redirect/{connection} | Start Google OAuth flow |
GET | /filaforms/connections/oauth/callback | OAuth callback |
GET | /filaforms/google-sheets/picker/{connection} | Open Drive Picker popup |
Troubleshooting
"The API developer key is invalid" : Enable the Google Picker API in Cloud Console and add it to your API key restrictions.
404 on OAuth authorization
: Ensure you're using the correct endpoint: https://accounts.google.com/o/oauth2/v2/auth (not /authorize).
Redirect URI mismatch
: The redirect URI must be registered as exactly https://your-domain.com/filaforms/connections/oauth/callback. Google Cloud Console settings can take 5 minutes to several hours to propagate after changes.
Spreadsheet picker not opening : Ensure a connected Google account is selected in the "Connected Account" dropdown. The picker requires a valid OAuth connection.
Missing scopes after OAuth : If the user doesn't grant all requested permissions, the connection is rejected. Re-connect and grant all requested scopes (Sheets, Drive, email).