# Google Docs

> Read and edit Google Docs via OAuth.

Lets an agent list, create, read, and batch-edit Google Docs.

## What it can do

| Method | What it does |
| --- | --- |
| `list_documents` | List Google Docs in Drive; name_contains and page_token optional. |
| `create_document` | Create an empty Google Doc with the given title. |
| `get_document` | Read a document by document_id; pass `fields` for a Docs API field mask. |
| `batch_update_document` | batchUpdate: array of Docs API requests. |

## How to get credentials

Google OAuth - no token to copy.

1. Start setup and enter the Google email.
2. Approve the consent screen (`documents`,
   `drive.metadata.readonly`).

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `USER_GOOGLE_EMAIL` | The Google account for the documents |

## Troubleshooting

- **Insert at wrong location** - Docs indexes are character-based and
  include headers; compute indexes from `get_document`, not visual
  intuition.

## Links

- [Docs API reference](https://developers.google.com/docs/api/reference/rest)
