Google Sheets 2.0
ToolJet has the capability to establish a connection with Google Sheets for both reading and writing data. By utilizing OAuth 2.0, ToolJet can establish a secure connection with Google Sheets, ensuring that the application's access to a user's account is restricted and limited appropriately.
Connection​
To establish a connection with the Google Sheets data source, you can either click on the + Add new Data source button located on the query panel or navigate to the Data Sources page through the ToolJet dashboard.
Authentication Types​
ToolJet supports two authentication methods for connecting Google Sheets to your application: OAuth 2.0 and Service Account. Each method provides a secure way to authorize access based on your integration requirements.
OAuth 2.0​
Authenticates via a Google user account using OAuth consent, allowing ToolJet to access Google Sheets based on the granted permissions. You can use this when data access should be tied to individual users or requires user-level consent and visibility.
OAuth Configuration
| Field | Description |
|---|---|
| OAuth type | Shown only on ToolJet Cloud. ToolJet app uses ToolJet's Google OAuth app, so you don't enter any credentials. Custom app uses your own Google OAuth client. Self-hosted ToolJet doesn't show this field and always uses a custom app. |
| Client ID | The client ID of your Google OAuth client. Shown when OAuth type is Custom app, and always on self-hosted ToolJet. |
| Client secret | The client secret of your Google OAuth client. Shown with Client ID. |
| Redirect URI | Read-only. Add this URL as an authorized redirect URI in your Google OAuth client. |
To connect with a custom app:
- In the Google Cloud console, create an OAuth client and add the Redirect URI shown in ToolJet as an authorized redirect URI.
- Enable the Google Sheets API. Also enable the Google Drive API, which ToolJet uses to list your spreadsheets.
- In ToolJet, enter the Client ID and Client secret, choose the access level under Authorize, and click Save and Connect to complete Google's consent screen.
Self-hosted ToolJet doesn't read the GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET environment variables for Google Sheets 2.0. They're used only by the ToolJet app OAuth type on ToolJet Cloud. Enter your OAuth client's credentials in the data source instead.
Multi-Factor Authentication
You can toggle on Authentication required for all users in the configuration. When enabled, users will be redirected to the OAuth consent screen the first time a query from this data source is triggered in the application. This ensures each user connects their own Google Sheets account securely.