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

# Google Docs Integration: Read & Edit Documents

> Read and edit Google Docs programmatically. Agents can create documents, insert text, and format content via the Docs API.

## Overview

OneCLI connects AI agents to Google Docs through Google's OAuth flow. Agents can read document content, create new documents, and edit existing ones. The gateway injects OAuth credentials into requests to the Google Docs API automatically.

This is useful for agents that generate reports, draft documentation, or need to read information stored in Google Docs. To manage the files themselves (search, organize, share), see [Google Drive](/integrations/google-drive).

## Setup

<Steps>
  <Step title="Go to Connections">
    Open the OneCLI dashboard and navigate to **Connections** > **Google Docs**.
  </Step>

  <Step title="Authorize">
    Click **Connect Google Docs**. You'll be redirected to Google to authorize OneCLI. Review the permissions and click **Allow**.
  </Step>
</Steps>

## What agents can do

* Read the full text content of a document
* Get document structure (headings, paragraphs, tables, lists)
* Create new documents with formatted content
* Insert, replace, or delete text in existing documents
* Add and modify tables, headers, and footers
* Apply text formatting (bold, italic, font size, color)
* Insert images and links into documents
* Read and add comments on a document

## Controlling access with rules

Use OneCLI's [rules engine](/guides/rules) to limit what agents can do with your documents. For example, you can allow read-only access so agents can extract information but not modify documents, or restrict access to specific document IDs. Rules are evaluated before credential injection, so a blocked request never reaches Google Docs.
