Skip to main content
Cadet | Tier 2
August 28, 2025
Question

Stuck at connect to Google Sheet

  • August 28, 2025
  • 12 replies
  • 276 views

Im running a Bot on Botrunner and where it gets to the line where connects to Google Sheet, gets stuck connecting forever, and it doesn’t throws an error. It says connect and active, but nothing is happening.

12 replies

Navigator | Tier 3
September 18, 2025

Hello, ​@Padmakumar.

In my case, the OAuth connection has been configured correctly. However, after exactly 60 minutes, the connection/token expires, requiring me to re-login from the Control Room. What I’m missing?

 

The behavior you describe (connection works immediately, but the token always expires after exactly 60 minutes and forces re-login) is not a Control Room bug. It’s the expected OAuth behavior when only an access token is issued and no refresh token is available.

Why this happens (brief)

  • Google issues access tokens that expire after ~3600 seconds (1 hour). If your integration was authorized only for "online" access (no refresh token), the Control Room has no way to get a new access token automatically, and the user must re-authorize after 60 minutes.
  • To avoid re-login, you need a refresh token (offline access) or use a service account (server-to-server) so no interactive re-login is required.

What you should do (two options)

  1. Enable a refresh token (recommended if you need to access users' personal accounts)
  • In the OAuth authorization flow for your Google OAuth Client, request offline access by adding:
    • access_type=offline
    • and if needed prompt=consent (to force Google to issue a refresh token if one was previously issued/revoked)
  • Ensure your OAuth client is set up in Google Cloud Console:
    • Enable the Google Sheets API (and Drive API if you need Drive-level scopes)
    • Create OAuth credentials (OAuth Client ID) and set the Control Room callback/redirect URI exactly as the Control Room expects
    • Set the proper scopes (e.g. https://www.googleapis.com/auth/spreadsheets or spreadsheets + drive scopes)
  • During initial authorization, show the consent screen; Google will then return a refresh_token along with the access_token. The refresh token can be used to obtain new access tokens automatically when the 1-hour access_token expires.
  • Make sure the Control Room or your connector stores the refresh_token securely (Credential Vault or equivalent) and uses it to refresh access tokens—if the Control Room connector does not store the refresh token, you will still be forced to re-login.
  1. Use a Google service account (recommended for unattended, server-to-server automation)
  • Create a service account in Google Cloud Console and download the JSON key.
  • Share the Google Sheet(s) with the service account’s email (or use domain-wide delegation + impersonation for G Suite/Workspace domain-wide access).
  • Configure the Control Room connector to use the service-account credentials (no interactive OAuth; tokens are obtained server-to-server and can be refreshed automatically).
  • This avoids interactive login and the 60-minute re-login problem entirely for automation scenarios.

How can I validate this point:

“Make sure the Control Room or your connector stores the refresh_token securely (Credential Vault or equivalent) and uses it to refresh access tokens—if the Control Room connector does not store the refresh token, you will still be forced to re-login“


?

Padmakumar
Premier Pathfinder | Tier 7
Premier Pathfinder | Tier 7
September 19, 2025

Hello, ​@Padmakumar.

In my case, the OAuth connection has been configured correctly. However, after exactly 60 minutes, the connection/token expires, requiring me to re-login from the Control Room. What I’m missing?

 

The behavior you describe (connection works immediately, but the token always expires after exactly 60 minutes and forces re-login) is not a Control Room bug. It’s the expected OAuth behavior when only an access token is issued and no refresh token is available.

Why this happens (brief)

  • Google issues access tokens that expire after ~3600 seconds (1 hour). If your integration was authorized only for "online" access (no refresh token), the Control Room has no way to get a new access token automatically, and the user must re-authorize after 60 minutes.
  • To avoid re-login, you need a refresh token (offline access) or use a service account (server-to-server) so no interactive re-login is required.

What you should do (two options)

  1. Enable a refresh token (recommended if you need to access users' personal accounts)
  • In the OAuth authorization flow for your Google OAuth Client, request offline access by adding:
    • access_type=offline
    • and if needed prompt=consent (to force Google to issue a refresh token if one was previously issued/revoked)
  • Ensure your OAuth client is set up in Google Cloud Console:
    • Enable the Google Sheets API (and Drive API if you need Drive-level scopes)
    • Create OAuth credentials (OAuth Client ID) and set the Control Room callback/redirect URI exactly as the Control Room expects
    • Set the proper scopes (e.g. https://www.googleapis.com/auth/spreadsheets or spreadsheets + drive scopes)
  • During initial authorization, show the consent screen; Google will then return a refresh_token along with the access_token. The refresh token can be used to obtain new access tokens automatically when the 1-hour access_token expires.
  • Make sure the Control Room or your connector stores the refresh_token securely (Credential Vault or equivalent) and uses it to refresh access tokens—if the Control Room connector does not store the refresh token, you will still be forced to re-login.
  1. Use a Google service account (recommended for unattended, server-to-server automation)
  • Create a service account in Google Cloud Console and download the JSON key.
  • Share the Google Sheet(s) with the service account’s email (or use domain-wide delegation + impersonation for G Suite/Workspace domain-wide access).
  • Configure the Control Room connector to use the service-account credentials (no interactive OAuth; tokens are obtained server-to-server and can be refreshed automatically).
  • This avoids interactive login and the 60-minute re-login problem entirely for automation scenarios.

How can I validate this point:

“Make sure the Control Room or your connector stores the refresh_token securely (Credential Vault or equivalent) and uses it to refresh access tokens—if the Control Room connector does not store the refresh token, you will still be forced to re-login“


?

  1. Connect action setup

    • In your bot, use Google Sheets → Connect with OAuth2 Authentication Mode = Control Room managed.
    • Click Pick and select your OAuth connection.
    • For unattended runs, choose Token type = Shared; for attended runs, User‑specific (make sure it shows Active under My settings → OAuth connections). 
  2. Minimal bot to run

    • Connect (as above, with a session name).
    • Open the spreadsheet using the Spreadsheet ID (more reliable than the URL).
    • Get single cell (e.g., Sheet1!A1) or Get the number of rows.
    • Disconnect.
      The “Open by ID” guidance and field definitions are in the official docs. 
  3. First run (T0)

    • Run the bot once to confirm it works now. No prompts should appear if CR OAuth is configured correctly. 
  4. Second run after token expiry

    • Wait 65–70 minutes (longer than typical access‑token lifetime).
    • Run the same bot again—without re‑authenticating in Control Room.
    • Expected result: It should work without any login prompt. This demonstrates Control Room used the stored refresh_token to mint a fresh access token on your behalf. 

Note: When using User‑specific tokens, ensure the connection shows Active under My settings → OAuth connections before your first run, and use Shared tokens for unattended scheduling to avoid interactive consent.

Padmakumar