Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Google Docs

Scalekit connector
Open markdown

The Google Docs connector lets your AI agent act in each user's Google Docs account. Each user signs in to Google Docs once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 47 tools.

Tools
47
What they doRead · write · destructive
4 · 36 · 74 read36 write7 destructive
Users sign in with
OAuth app
Your own Google app

What you can do

  • Read and list documents: find Docs in Drive by name and read their full content, formatting, and structure
  • Create and copy documents: create blank Docs, duplicate existing ones, and export them to PDF, Word, or HTML
  • Edit text: insert, delete, and find and replace text, and fill named ranges for templating
  • Format documents: apply text styles, headings, lists, page margins, headers, footers, and page breaks
  • Build tables and add images: insert and edit tables, merge cells, and add or replace inline images
  • Handle comments and suggestions: add, reply to, resolve, and delete comments, and accept or reject suggestions

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Google Docs connection

    In AgentKit > Connections, create a Google Docs connection and copy its redirect URI. The name you give it is the connection_name your code passes. See Configure connections.

  4. Register a Google OAuth app

    Google Docs connections use your own OAuth app. Register one with Google and add the redirect URI you copied.

    Then enter the app's Client ID and Client Secret on the Google Docs connection.

    Console steps with screenshots

    Register your Scalekit environment with the Google Docs connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. Then complete the configuration in your application as follows:

    1. Set up auth redirects

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Google Docs and click Create. Click Use your own credentials and copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

        Copy redirect URI from Scalekit dashboard

      • Navigate to Google Cloud Console → APIs & Services → Credentials. Select + Create Credentials, then OAuth client ID. Choose Web application from the Application type menu.

        Select Web Application in Google OAuth settings

      • Under Authorized redirect URIs, click + Add URI, paste the redirect URI, and click Create.

        Add authorized redirect URI in Google Cloud Console

    2. Enable the Google Docs API

      • In Google Cloud Console, go to APIs & Services → Library. Search for “Google Docs API” and click Enable.
    3. Get client credentials

      • Google provides your Client ID and Client Secret after you create the OAuth client ID in step 1.
    4. Add credentials in Scalekit

      • In Scalekit dashboard, go to AgentKit > Connections and open the connection you created.

      • Enter your credentials:

        Add credentials in Scalekit dashboard

      • Click Save.

  5. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'googledocs'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Google Docs:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'googledocs_list_documents',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • googledocs_export_documentExport a Google Doc to another format such as PDF, plain text, HTML, Word (.docx), RTF, or EPUB.Read-only

    Export Document

    Export a Google Doc to another format such as PDF, plain text, HTML, Word (.docx), RTF, or EPUB. Uses the Drive API export endpoint. Exported files are limited to 10 MB.

    Inputs

    document_idstringrequired
    The ID of the Google Doc to export
    mime_typestringrequired
    The MIME type of the target export formatone of application/pdftext/plaintext/htmlapplication/vnd.openxmlformats-officedocument.wordprocessingml.documentapplication/rtfapplication/epub+zipapplication/vnd.oasis.opendocument.text

    Also accepts schema_version and tool_version to pin a version.

  • googledocs_list_commentsList the comments on a Google Doc, including their replies and resolved status.Read-only

    List Comments

    List the comments on a Google Doc, including their replies and resolved status. Comments are managed through the Drive API. Supports pagination.

    Inputs

    document_idstringrequired
    The ID of the Google Doc whose comments to list
    include_deletedboolean
    Whether to include deleted comments. Deleted comments have their content and author stripped. Defaults to false.
    page_sizeinteger
    Maximum number of comments to return per page (1-100, default 20)
    page_tokenstring
    Token for retrieving the next page of results. Use the nextPageToken from a previous response.
    start_modified_timestring
    Only return comments modified after this RFC 3339 timestamp

    Also accepts schema_version and tool_version to pin a version.

  • googledocs_list_documentsList all Google Docs documents in the user's Drive.Read-only

    List Google Docs

    List all Google Docs documents in the user's Drive. Optionally search by document name. Returns document IDs, names, and metadata with pagination support.

    Inputs

    order_bystring
    Sort order for results. Examples: modifiedTime desc, name asc, createdTime desc
    page_sizeinteger
    Number of documents to return per page (max 1000, default 100)
    page_tokenstring
    Token for retrieving the next page of results. Use the nextPageToken from a previous response.
    querystring
    Drive search query to filter documents. Defaults to all Google Docs. To search by name, use: mimeType = 'application/vnd.google-apps.document' and trashed = false and name contains 'report'
  • googledocs_read_documentRead the complete content and structure of a Google Doc including text, formatting, tables, and metadata.Read-only

    Read Google Doc

    Read the complete content and structure of a Google Doc including text, formatting, tables, and metadata.

    Inputs

    document_idstringrequired
    The ID of the Google Doc to read
    suggestions_view_modestring
    How suggestions are rendered in the responseone of DEFAULT_FOR_CURRENT_ACCESSSUGGESTIONS_INLINEPREVIEW_SUGGESTIONS_ACCEPTEDPREVIEW_WITHOUT_SUGGESTIONS

    Also accepts schema_version and tool_version to pin a version.

  • googledocs_accept_suggestionAccept a single tracked-change suggestion in a Google Doc by its suggestion ID, permanently applying the suggested edit.Write

    Accept Suggestion

    Accept a single tracked-change suggestion in a Google Doc by its suggestion ID, permanently applying the suggested edit. Suggestion IDs are found in the document's JSON content when reading with suggestions view mode enabled.

    • Idempotent

    Inputs

    document_idstringrequired
    The ID of the Google Doc to edit
    suggestion_idstringrequired
    The ID of the suggestion to accept.
  • googledocs_apply_text_styleApply character formatting (bold, italic, underline, strikethrough, font size) to a range of text in a Google Doc.Write

    Apply Text Style

    Apply character formatting (bold, italic, underline, strikethrough, font size) to a range of text in a Google Doc. Only the attributes you set are changed.

    • Idempotent

    Inputs

    document_idstringrequired
    The ID of the Google Doc to edit
    end_indexintegerrequired
    End index of the range to format (exclusive)
    start_indexintegerrequired
    Zero-based start index of the range to format (inclusive)
    boldboolean
    Set text to bold (true) or non-bold (false)
    font_size_ptnumber
    Font size in points
    italicboolean
    Set text to italic (true) or non-italic (false)
    strikethroughboolean
    Set text to struck through (true) or not (false)
    underlineboolean
    Set text to underlined (true) or not (false)

    Also accepts schema_version and tool_version to pin a version.

  • googledocs_copy_documentDuplicate a Google Doc.Write

    Copy Document

    Duplicate a Google Doc. Optionally rename the copy or place it in a specific Drive folder. Uses the Drive API and returns the new document's metadata.

    Inputs

    document_idstringrequired
    The ID of the Google Doc to copy
    namestring
    Name for the copied document. If omitted, the copy is named 'Copy of <original name>'.
    parent_folder_idstring
    ID of the destination folder for the copy. If omitted, the copy is placed in the same folder as the original.

    Also accepts schema_version and tool_version to pin a version.

  • googledocs_create_commentAdd a comment to a Google Doc.Write

    Create Comment

    Add a comment to a Google Doc. Comments are managed through the Drive API. Optionally anchor the comment to a quoted section of the document.

    Inputs

    contentstringrequired
    The plain-text content of the comment
    document_idstringrequired
    The ID of the Google Doc to comment on

    Also accepts schema_version and tool_version to pin a version.

Workflows

Proxy API call
const result = await actions.request({
connectionName: 'googledocs',
identifier: 'user_123',
path: '/v1/documents/<DOCUMENT_ID>',
method: 'GET',
});
console.log(result);
Execute a tool
const result = await actions.executeTool({
connector: 'googledocs',
identifier: 'user_123',
toolName: 'googledocs_create_document',
toolInput: {},
});
console.log(result);
Google OAuth consent screen verification

Before you use your own Google OAuth credentials in production, understand what end users see on Google’s consent screen when they authorize a connected account.

Audience typeConsent screen behaviorWhen to use
InternalShows your App Name and logo from Branding settingsOnly users in your Google Workspace or Cloud Identity organization can authorize the connector
ExternalShows {env_name}.scalekit.dev until Google verifies your appAny user with a Google account can authorize the connector

Why External is required for most AgentKit connectors:

  • Internal restricts authorization to users in your Google Workspace or Cloud Identity organization. Users with @gmail.com or other Google accounts outside your organization cannot complete OAuth.
  • External is required when end users outside your organization authorize tool access through connected accounts.
  • Organization-managed OAuth clients follow the same rules as personal or developer OAuth clients. Switching to an org-owned client does not bypass Google verification.
  • Until Google completes verification of your External app, users see scalekit.dev on the consent screen. After verification, your App Name and logo appear.

During development:

  • Add Test users under APIs & Services → OAuth consent screen while publishing status is Testing.
  • On unverified apps, users can click Advanced → Go to app (unsafe) to proceed during testing.
  • Google Workspace admins may need to allowlist your OAuth client.

For Google’s verification requirements and timeline, refer to Google’s OAuth consent screen verification guide.