Google Docs
SDK reference for google docs operations
Overview
Google Docs document creation and editing
- Category:
productivity - Auth Required: Yes
- Supported Modes: standard, delegated
Operations
createDocument
Create a new Google Doc
Arguments:
title(string, required): Title of the document
Returns:
AdapterOperationResult - Created document with documentId and title
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the created document |
title | string | Title of the created document |
Example:
getDocument
Get a Google Doc by ID. Returns normalized flat structure with extracted fields.
Arguments:
documentId(string, required): ID of the document
Returns:
AdapterOperationResult - Normalized document with documentId, title, body, url, hasContent fields
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
title | string | Title of the document |
revisionId | string | Current revision ID |
body | string | Plain text content of the document |
bodyLength | number | Character count of the body |
lastEditedTime | string | ISO 8601 timestamp of last edit (optional) |
url | string | URL to the document |
hasContent | boolean | Whether document has any text content |
Example:
appendText
Append text to the end of a document
Arguments:
documentId(string, required): ID of the documenttext(string, required): Text to append
Returns:
AdapterOperationResult - Append operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
replaceText
Replace text in a document
Arguments:
documentId(string, required): ID of the documentsearchText(string, required): Text to search forreplaceText(string, required): Text to replace with
Returns:
AdapterOperationResult - Replace operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
getDocumentContent
Get the text content of a Google Doc
Arguments:
documentId(string, required): ID of the document
Returns:
AdapterOperationResult - Document text content
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
content | string | Plain text content of the document |
Example:
insertTextAtPosition
Insert text at a specific position in the document
Arguments:
documentId(string, required): ID of the documenttext(string, required): Text to insertposition(number, required): Character position to insert at (1-indexed)
Returns:
AdapterOperationResult - Insert operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
insertTextAfter
Insert text after a search string in the document
Arguments:
documentId(string, required): ID of the documentsearchText(string, required): Text to search fortextToInsert(string, required): Text to insert after the search textoccurrence(number, optional): Which occurrence to insert after (default: 1)
Returns:
AdapterOperationResult - Insert operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
insertHeading
Insert a heading into the document
Arguments:
documentId(string, required): ID of the documenttext(string, required): Heading textlevel(number, required): Heading level (1-6)position(number, optional): Character position to insert atinsertAfterText(string, optional): Insert after this text instead of at position
Returns:
AdapterOperationResult - Insert operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
insertList
Insert a bulleted or numbered list into the document
Arguments:
documentId(string, required): ID of the documentitems(array, required): Array of list itemslistType(string, required): Type of list: "bulleted" or "numbered"position(number, optional): Character position to insert atinsertAfterText(string, optional): Insert after this text instead of at position
Returns:
AdapterOperationResult - Insert operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
insertTable
Insert a table into the document
Arguments:
documentId(string, required): ID of the documentdata(array, required): 2D array of table data (rows x columns)hasHeader(boolean, optional): Whether the first row is a header (default: true)position(number, optional): Character position to insert atinsertAfterText(string, optional): Insert after this text instead of at position
Returns:
AdapterOperationResult - Insert operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
updateDocumentContent
Replace the entire content of a document
Arguments:
documentId(string, required): ID of the documentnewContent(string, required): New content to replace existing content
Returns:
AdapterOperationResult - Update operation result
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
success | boolean | Whether the operation succeeded |
feedback | string | Human-readable feedback about the operation |
Example:
createSection
Create a new section with a heading and content. Returns normalized result with insertion details.
Arguments:
documentId(string, required): ID of the documentheading(string, required): Section heading textcontent(string, required): Section content text
Returns:
AdapterOperationResult - Normalized section result with documentId, title, url, heading, insertionIndex, success
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
title | string | Title of the document |
url | string | URL to the document |
heading | string | The heading text that was created |
insertionIndex | number | Character position where section was inserted |
success | boolean | Whether the operation succeeded |
Example:
findInsertionPoint
Find the character position for insertion based on position or search text. Returns normalized result with position and context.
Arguments:
documentId(string, required): ID of the documentposition(number, required): Position to find (1 for start, -1 for end)searchText(string, optional): Text to search for (returns position after this text)
Returns:
AdapterOperationResult - Normalized insertion point with documentId, title, url, position, context, documentLength
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | ID of the document |
title | string | Title of the document |
url | string | URL to the document |
position | number | Character position for insertion |
context | string | Text context around the insertion point |
documentLength | number | Total character length of the document |
Example: