Skip to main content
GoogleSheetsTools enable an Agent to interact with Google Sheets API for reading, creating, updating, and duplicating spreadsheets.

Prerequisites

You need to install the required Google API client libraries:
Set up the following environment variables:

How to Get Credentials

  1. Go to Google Cloud Console (https://console.cloud.google.com)
  2. Create a new project or select an existing one
  3. Enable the Google Sheets API:
    • Go to “APIs & Services” > “Enable APIs and Services”
    • Search for “Google Sheets API”
    • Click “Enable”
  4. Create OAuth 2.0 credentials:
    • Go to “APIs & Services” > “Credentials”
    • Click “Create Credentials” > “OAuth client ID”
    • Go through the OAuth consent screen setup
    • Give it a name and click “Create”
    • You’ll receive:
      • Client ID (GOOGLE_CLIENT_ID)
      • Client Secret (GOOGLE_CLIENT_SECRET)
    • The Project ID (GOOGLE_PROJECT_ID) is visible in the project dropdown at the top of the page

Example

The following agent will use Google Sheets to read spreadsheet data.
cookbook/91_tools/googlesheets_tools.py

Toolkit Params

The legacy aliases enable_read_sheet, enable_create_sheet, enable_update_sheet, and enable_create_duplicate_sheet are also accepted. When one is passed, it overrides the matching bare flag.

Toolkit Functions

Developer Resources