Use cases and templates: Google Docs integration for AI agents
Use Google Docs in Sim to read, create, and update documents. Workflows can insert text, tables, images, and page breaks; find and replace text; and apply text styling.
Sim requests these scopes when someone connects a Google Docs account. For a self-hosted deployment, register your own app with the provider using the settings below. See Integrations and OAuth for setup.
| Setting | Value |
|---|
| Redirect URI | <NEXT_PUBLIC_APP_URL>/api/auth/oauth2/callback/google-docs |
| Environment variables | GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET |
| Scope | Description |
|---|
https://www.googleapis.com/auth/userinfo.email | View email address |
https://www.googleapis.com/auth/userinfo.profile | View basic profile info |
https://www.googleapis.com/auth/drive.file | View and manage Google Drive files you open or create with Sim |
https://www.googleapis.com/auth/drive | View, edit, create, and delete all Google Drive files |
Read, write, and create documents, insert text, tables, images, and page breaks, find and replace text, and apply text styling.
Read content from a Google Docs document
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | Google Docs document ID |
| Parameter | Type | Description |
|---|
content | string | Extracted document text content |
metadata | json | Document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Append content to a Google Docs document. Content is inserted literally; Markdown is not interpreted. For formatted output from Markdown, use the Create operation with the markdown toggle enabled.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to write to |
content | string | Yes | The content to write to the document |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if document content was updated successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Create a new Google Docs document
| Parameter | Type | Required | Description |
|---|
title | string | Yes | The title of the document to create |
content | string | No | The content of the document to create |
folderSelector | string | No | Google Drive folder ID to create the document in (e.g., 1ABCxyz...) |
folderId | string | No | The ID of the folder to create the document in (internal use) |
markdown | boolean | No | When true, content is interpreted as Markdown and converted to formatted Google Docs content (headings, bold/italic, lists, tables, links, code blocks, blockquotes). Default: false (content inserted as plain text). |
| Parameter | Type | Description |
|---|
metadata | json | Created document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Insert text at a specific index in a Google Docs document. When no index is provided, text is appended to the end of the document. Text is inserted literally; Markdown is not interpreted.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to insert text into |
text | string | Yes | The text to insert |
index | number | No | The character index (the document body starts at index 1) at which to insert the text. When omitted, text is appended to the end of the document. |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if text was inserted successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Replace all occurrences of a search string with new text across a Google Docs document.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to update |
searchText | string | Yes | The text to find |
replaceText | string | No | The text to replace matches with. Use an empty string to delete matches. |
matchCase | boolean | No | Whether the search should be case sensitive. Defaults to false. |
| Parameter | Type | Description |
|---|
occurrencesChanged | number | The number of occurrences that were replaced |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Insert an empty table with the given number of rows and columns into a Google Docs document. When no index is provided, the table is appended to the end of the document.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to insert the table into |
rows | number | Yes | The number of rows in the table |
columns | number | Yes | The number of columns in the table |
index | number | No | The character index (the document body starts at index 1) at which to insert the table. When omitted, the table is appended to the end of the document. |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the table was inserted successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Insert an inline image from a public URL into a Google Docs document. The image must be publicly accessible and under 50 MB. When no index is provided, the image is appended to the end of the document.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to insert the image into |
imageUrl | string | Yes | The publicly accessible URL of the image to insert |
index | number | No | The character index (the document body starts at index 1) at which to insert the image. When omitted, the image is appended to the end of the document. |
width | number | No | Optional image width in points (PT) |
height | number | No | Optional image height in points (PT) |
| Parameter | Type | Description |
|---|
objectId | string | The ID of the inserted inline image object |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Insert a page break into a Google Docs document. When no index is provided, the page break is appended to the end of the document.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to insert the page break into |
index | number | No | The character index (the document body starts at index 1) at which to insert the page break. When omitted, the page break is appended to the end of the document. |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the page break was inserted successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Apply bold, italic, underline, and/or font size to a range of text in a Google Docs document, identified by its start and end character index.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to update |
startIndex | number | Yes | The start character index (the document body starts at index 1) of the range to style (inclusive) |
endIndex | number | Yes | The end character index of the range to style (exclusive) |
bold | boolean | No | Whether to make the text bold |
italic | boolean | No | Whether to make the text italic |
underline | boolean | No | Whether to underline the text |
fontSize | number | No | The font size to apply, in points (PT) |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the text style was applied successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Apply a named paragraph style (such as a heading or title) and/or alignment to the paragraphs overlapping a range of text in a Google Docs document, identified by its start and end character index.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to update |
startIndex | number | Yes | The start character index (the document body starts at index 1) of the range to style (inclusive) |
endIndex | number | Yes | The end character index of the range to style (exclusive) |
namedStyleType | string | No | The named paragraph style to apply. One of: NORMAL_TEXT, TITLE, SUBTITLE, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6. |
alignment | string | No | The paragraph alignment to apply. One of: LEFT, CENTER, RIGHT, JUSTIFY. |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the paragraph style was applied successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Add bulleted or numbered list formatting to the paragraphs overlapping a range of text in a Google Docs document, using a chosen bullet glyph preset.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to update |
startIndex | number | Yes | The start character index (the document body starts at index 1) of the range to bullet (inclusive) |
endIndex | number | Yes | The end character index of the range to bullet (exclusive) |
bulletPreset | string | No | The bullet glyph preset to apply. Defaults to BULLET_DISC_CIRCLE_SQUARE. Examples: BULLET_DISC_CIRCLE_SQUARE, BULLET_CHECKBOX, NUMBERED_DECIMAL_ALPHA_ROMAN, NUMBERED_DECIMAL_NESTED. |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the bullets were applied successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Remove bullet or numbered list formatting from the paragraphs overlapping a range of text in a Google Docs document, identified by its start and end character index.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to update |
startIndex | number | Yes | The start character index (the document body starts at index 1) of the range to clear bullets from (inclusive) |
endIndex | number | Yes | The end character index of the range to clear bullets from (exclusive) |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the bullets were removed successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Delete all content between a start and end character index in a Google Docs document. The endIndex is exclusive and must be greater than the startIndex.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to delete content from |
startIndex | number | Yes | The start character index (the document body starts at index 1) of the range to delete (inclusive) |
endIndex | number | Yes | The end character index of the range to delete (exclusive) |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the content range was deleted successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Create a named range over a span of content in a Google Docs document so it can be referenced or deleted later. The name may be 1-256 characters and need not be unique.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to update |
name | string | Yes | The name of the range to create (1-256 characters) |
startIndex | number | Yes | The start character index (the document body starts at index 1) of the range (inclusive) |
endIndex | number | Yes | The end character index of the range (exclusive) |
| Parameter | Type | Description |
|---|
namedRangeId | string | The ID of the created named range |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |
Delete one or more named ranges from a Google Docs document by their ID or by name. Provide exactly one of namedRangeId or name; deleting by name removes all ranges sharing that name. The content itself is not removed.
| Parameter | Type | Required | Description |
|---|
documentId | string | Yes | The ID of the document to update |
namedRangeId | string | No | The ID of the named range to delete. Provide exactly one of namedRangeId or namedRangeName. |
namedRangeName | string | No | The name of the named range(s) to delete. All ranges sharing this name are removed. Provide exactly one of namedRangeId or namedRangeName. |
| Parameter | Type | Description |
|---|
updatedContent | boolean | Indicates if the named range(s) were deleted successfully |
metadata | json | Updated document metadata including ID, title, and URL |
↳ documentId | string | Google Docs document ID |
↳ title | string | Document title |
↳ mimeType | string | Document MIME type |
↳ url | string | Document URL |