> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subverseai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Sheets OAuth2 API Credentials

> How to create and configure Google Sheets OAuth2 API credentials for SubverseAI

# Google Sheets OAuth2 API Credentials

Google Sheets OAuth2 API credentials allow your SubverseAI agents to access Google Sheets using your own Google account through the standard OAuth2 flow. This lets you read and write any spreadsheet your Google account can access — no manual sheet sharing required.

## Overview

Google Sheets OAuth2 credentials provide access to:

* Reading and writing data on any spreadsheet your Google account can access
* Creating new spreadsheets owned by your account
* Adding, clearing, and deleting rows
* Managing sheets (tabs) within a spreadsheet
* Automatic token refresh without manual key rotation

<Info>
  OAuth2 credentials access sheets as your Google user, so any spreadsheet you can open in Google Sheets is available — including sheets shared with you by others. Unlike the [Service Account](/credentials/types/google-sheets-service-account) credential, you do not need to share each sheet with a service account email.
</Info>

## Steps to Create Google Sheets OAuth2 API Credentials

### 1. Set Up a Google Cloud Project

1. Visit the [Google Cloud Console](https://console.cloud.google.com)
2. Sign in with the Google account you want to use for sheet access
3. Create a new project or select an existing one

### 2. Enable the Google Sheets API

1. Navigate to **APIs & Services** > **Library**
2. Search for **Google Sheets API**
3. Click **Enable**

### 3. Configure the OAuth Consent Screen

1. Go to **APIs & Services** > [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent)
2. Choose **External** (or **Internal** if you are on a Google Workspace organisation)
3. Fill in the required app information:
   * **App name**: e.g. "SubverseAI Sheets Integration"
   * **User support email**: your email
   * **Developer contact email**: your email
4. Click **Save and Continue**
5. On the **Scopes** step, add the `https://www.googleapis.com/auth/spreadsheets` scope
6. Click **Save and Continue**
7. If using **External**, add your own Google account email as a **Test user** on the **Test users** step

### 4. Create OAuth2 Client Credentials

1. Go to **APIs & Services** > [Credentials](https://console.cloud.google.com/apis/credentials)
2. Click **Create Credentials** > **OAuth client ID**
3. Select **Web application** as the application type
4. Enter a name (e.g. "SubverseAI OAuth2 Client")
5. Under **Authorized redirect URIs**, add the SubverseAI callback URL shown in the credential creation form
6. Click **Create**
7. Note the **Client ID** and **Client Secret** displayed on the confirmation page

### 5. Add to SubverseAI

1. Go to **Credentials** in your SubverseAI dashboard
2. Click **Create New Credential**
3. Select **Google Sheets OAuth2 API** from the credential types
4. Enter a name for your credential (e.g. "My Google Account")
5. Fill in the required fields:
   * **Client ID**: The OAuth client ID from step 4
   * **Client Secret**: The OAuth client secret from step 4
6. Click **Connect Account** — you will be redirected to Google to grant access
7. After authorizing, you will be returned to SubverseAI and the credential will be saved

## Required Fields

* **Name**: A descriptive name for your credential
* **Client ID**: Your Google OAuth2 client ID
* **Client Secret**: Your Google OAuth2 client secret

## Usage Tips

* Use the narrowest scope that covers your needs. The `spreadsheets` scope grants full read/write access to all sheets your account can reach
* For automated, server-to-server access to specific sheets, consider the [Service Account](/credentials/types/google-sheets-service-account) credential instead — it does not require a browser-based consent flow
* For read-only access to public sheets, use the [API Key](/credentials/types/google-sheets-api-key) credential
* Keep your client secret secure and never commit it to version control

## Troubleshooting

**Redirect URI Mismatch**: Ensure the redirect URI in your Google Cloud OAuth client exactly matches the callback URL shown in the SubverseAI credential form

**Access Blocked (403 access\_denied)**: If your app is in **Testing** mode, make sure your Google account email is listed under **Test users** on the OAuth consent screen. Alternatively, publish the app from the consent screen

**API Not Enabled**: Ensure the Google Sheets API is enabled in the same Cloud project where you created the OAuth client

**Invalid Client**: Verify the Client ID and Client Secret were copied correctly from the Google Cloud Console

**Token Expired**: SubverseAI automatically refreshes OAuth2 tokens. If refresh fails, reconnect the account from the credential edit page

## Next Steps

After creating your Google Sheets OAuth2 credentials:

* Read and write data in any spreadsheet your Google account can access
* Create new spreadsheets and add sheets programmatically
* Build reporting and data sync automations without manual sheet sharing
* Use the [Google Sheets node](/agentverse/nodes/google-sheets) in AgentVerse workflows
