Reference · Tools
Google Docs
Create, get, and update Google Docs documents using the Google Docs and Drive APIs.
The Google Docs node lets you create, fetch, and update Google Docs documents directly from a BusyBot workflow. You can generate a new document in a specific Drive folder, extract its plain text, or push structured edits — for example, automatically drafting a client report from form data and dropping it into a shared folder.
- Node type
- Action
- Parameters
- 15
- Outputs
- Output, Error
- Credentials
- Google Docs OAuth2 , Google API (Service Account)
Google Docs
Create, retrieve, and update Google Docs documents with full batchUpdate support.
Overview
Google Docs tool provides access to the Google Docs API (v1) and Google Drive API (v3). Three operations on the “document” resource: create (POST Drive API /files with mimeType=application/vnd.google-apps.document, optional folderId and driveId); get (GET Docs API /documents/{id}, with simple=true extracting plain text from body.content paragraphs, or simple=false returning raw JSON); update (POST Docs API /documents/{id}:batchUpdate with a fixedCollection of actions that build requests for text/insert, text/replaceAll, header/create, header/delete, footer/create, footer/delete, namedRange/create, namedRange/delete, pageBreak/insert, paragraphBullets/create, paragraphBullets/delete, positionedObject/delete, table/insert, tableColumn/insert, tableColumn/delete, tableRow/insert, tableRow/delete, with optional writeControl targetRevisionId or requiredRevisionId). Authentication via OAuth2 (googleDocsOAuth2Api) or Service Account (googleApi). Document ID can be extracted from a full Google Docs URL or passed directly as a raw ID.
Category: Productivity
Tool Name: google_docs
Version: 1
Appearance: Icon: lucide-FileText | Color: #4285F4
Node Type
Action — processes input items and produces output
Input / Output
| Direction | Port(s) |
|---|---|
| Input | Input |
| Output | Output, Error |
Credentials
This tool supports two authentication methods — Google Docs OAuth2 and Google API (Service Account). Configure one of them and select the matching value in the Authentication parameter. See the Credentials Guide for setup instructions.
Resources
| Resource | Value |
|---|---|
| Document | document |
Operations
| Operation | Value | Description |
|---|---|---|
| Create | create | Create a new Google Docs document. |
| Get | get | Get a document by ID or URL. |
| Update | update | Update a document using batchUpdate with one or more actions. |
Parameters
Document: Create (create)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Title | string | Yes | — | The title of the document to create. Supports expressions like {{ $json.title }}. |
| Folder ID | string | No | — | ID of the Google Drive folder in which to create the document. Leave empty to create in the root of My Drive. |
| Drive ID | string | No | — | ID of a Shared Drive. If provided, supportsAllDrives=true is added to the request to support shared drives. |
Document: Get (get)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Document URL or ID | string | Yes | — | The full Google Docs URL or just the document ID. The ID is extracted from the URL pattern /d/{DOCUMENT_ID}/. Supports expressions. |
| Simplify | boolean | No | true | For get: return extracted plain text ({ documentId, content }) instead of raw JSON. For update: return the first non-empty reply from replies[] instead of the full batchUpdate response. |
Document: Update (update)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Document URL or ID | string | Yes | — | The full Google Docs URL or just the document ID. The ID is extracted from the URL pattern /d/{DOCUMENT_ID}/. Supports expressions. |
| Simplify | boolean | No | true | For get: return extracted plain text ({ documentId, content }) instead of raw JSON. For update: return the first non-empty reply from replies[] instead of the full batchUpdate response. |
| Actions | fixedCollection | No | {"actionFields":[{"object":"text","action":"insert","locationChoice":"endOfSegmentLocation","insertSegment":"body","index":0,"text":""}]} | Actions to apply to update the document. Each action corresponds to one Docs API batchUpdate request. Add as many actions as you need — they are applied in order in a single batch. |
| — Object | options | No | text | The document object type to act upon. |
Options: footer, header, namedRange, pageBreak, paragraphBullets, positionedObject, table, tableColumn, tableRow, text | ||||
| — Action | options | No | insert | The action to perform on text. (shown when Object is text) |
Options: replaceAll (find and replace text), insert | ||||
| — Action | options | No | create | The action to perform. (shown when Object is footer, header, namedRange, paragraphBullets) |
Options: create, delete | ||||
| — Action | options | No | insert | The action to perform. (shown when Object is tableColumn, tableRow) |
Options: delete, insert | ||||
| — Action | options | No | insert | The action to perform. (shown when Object is pageBreak, table) |
Options: insert | ||||
| — Action | options | No | delete | The action to perform. (shown when Object is positionedObject) |
Options: delete | ||||
| — Insert Segment | options | No | body | The document segment (body, header, or footer) where the object will be created. (shown when Object is footer, header, paragraphBullets, namedRange and Action is create) |
Options: body, footer, header | ||||
| — Segment ID | string | No | — | The ID of the header, footer, or footnote segment. Retrieve from document/get (simple=false). (shown when Object is footer, header, paragraphBullets, namedRange and Action is create; hidden when Insert Segment is body) |
| — Index | number | No | 0 | The zero-based index within the segment at the section break location. (shown when Object is footer, header and Action is create) |
— Name (name) | string | No | — | The name of the Named Range. Names do not need to be unique. (shown when Object is namedRange and Action is create) |
| — Start Index | number | No | 0 | The zero-based start index of this range. (shown when Object is namedRange and Action is create) |
| — End Index | number | No | 0 | The zero-based end index of this range. (shown when Object is namedRange and Action is create) |
| — Style | options | No | BULLET_DISC_CIRCLE_SQUARE | The preset bullet/numbering style. (shown when Object is paragraphBullets and Action is create) |
Options: BULLET_DISC_CIRCLE_SQUARE (DISC, CIRCLE, SQUARE glyphs for the first 3 nesting levels), BULLET_CHECKBOX (checkbox glyphs for all nesting levels), NUMBERED_DECIMAL_NESTED (decimal glyphs with period separators; nested numbering) | ||||
| — Footer ID | string | No | — | The ID of the footer to delete. Retrieve from document/get (simple=false) under the “footers” key. (shown when Object is footer and Action is delete) |
| — Header ID | string | No | — | The ID of the header to delete. Retrieve from document/get (simple=false) under the “headers” key. (shown when Object is header and Action is delete) |
| — Specify Range By | options | No | namedRangeId | Whether to delete the named range by its ID or by name. (shown when Object is namedRange and Action is delete) |
Options: namedRangeId, name | ||||
| — ID | string | No | — | The ID of the named range to delete. (shown when Object is namedRange, Action is delete and Specify Range By is namedRangeId) |
— Name (value) | string | No | — | The name of the named range to delete. (shown when Object is namedRange, Action is delete and Specify Range By is name) |
| — Object ID | string | No | — | The ID of the positioned object to delete. (shown when Object is positionedObject and Action is delete) |
| — Insert Segment | options | No | body | The document segment (body, header, or footer) in which to insert. (shown when Object is pageBreak, table, tableColumn, tableRow, text and Action is insert) |
Options: body, footer, header | ||||
| — Segment ID | string | No | — | The ID of the header, footer, or footnote segment. Retrieve from document/get (simple=false). (shown when Object is pageBreak, table, tableColumn, tableRow, text and Action is insert; hidden when Insert Segment is body) |
| — Insert Location | options | No | endOfSegmentLocation | Where in the segment to insert the page break. (shown when Object is pageBreak and Action is insert) |
Options: endOfSegmentLocation (at end of segment), location (at index) | ||||
| — Index | number | No | 1 | The zero-based index within the segment at which to insert the page break. Minimum 1. (shown when Insert Location is location, Object is pageBreak and Action is insert) |
| — Insert Location | options | No | endOfSegmentLocation | Where in the segment to insert the table. (shown when Object is table and Action is insert) |
Options: endOfSegmentLocation (at end of segment), location (at index) | ||||
| — Index | number | No | 1 | The zero-based index within the segment at which to insert the table (use index + 1 to refer to a table). Minimum 1. (shown when Insert Location is location, Object is table and Action is insert) |
| — Rows | number | No | 0 | The number of rows in the table. (shown when Object is table and Action is insert) |
| — Columns | number | No | 0 | The number of columns in the table. (shown when Object is table and Action is insert) |
| — Insert Location | options | No | endOfSegmentLocation | Where in the segment to insert the text. (shown when Object is text and Action is insert) |
Options: endOfSegmentLocation (at end of segment), location (at index) | ||||
| — Index | number | No | 1 | The zero-based index within the segment at which to insert the text. Minimum 1. (shown when Insert Location is location, Object is text and Action is insert) |
| — Text | string | No | — | The text to insert at the specified location. Supports expressions like {{ $json.body }}. (shown when Object is text and Action is insert) |
| — Old Text | string | No | — | The text to search for in the document. (shown when Object is text and Action is replaceAll) |
| — New Text | string | No | — | The replacement text. Supports expressions. (shown when Object is text and Action is replaceAll) |
| — Match Case | boolean | No | false | Whether the text search is case-sensitive. (shown when Object is text and Action is replaceAll) |
| — Insert Segment | options | No | body | The document segment in which the object to delete resides. (shown when Object is paragraphBullets, tableColumn, tableRow and Action is delete) |
Options: body, footer, header | ||||
| — Segment ID | string | No | — | The ID of the header, footer, or footnote segment. (shown when Object is paragraphBullets, tableColumn, tableRow and Action is delete; hidden when Insert Segment is body) |
| — Start Index | number | No | 0 | The zero-based start index of the range for paragraph bullets. (shown when Object is paragraphBullets) |
| — End Index | number | No | 0 | The zero-based end index of the range for paragraph bullets. (shown when Object is paragraphBullets) |
| — Insert Position | options | No | true | Whether to insert the new column/row before or after the reference cell. (shown when Object is tableColumn, tableRow and Action is insert) |
Options: true (after the content at the index), false (before the content at the index) | ||||
| — Index | number | No | 1 | The zero-based index of the table start location within the segment (use index + 1 to refer to a table). Minimum 1. (shown when Object is tableColumn, tableRow) |
| — Row Index | number | No | 0 | The zero-based row index of the reference table cell. (shown when Object is tableColumn, tableRow) |
| — Column Index | number | No | 0 | The zero-based column index of the reference table cell. (shown when Object is tableColumn, tableRow) |
| Revision Control | options | No | none | Optional concurrency control. Use “none” to apply to the latest revision without checking. |
Options: none (apply the update to the latest revision), targetRevisionId (apply if the revision matches; fail otherwise), requiredRevisionId (apply on top of the given revision, incorporating other collaborators’ changes) | ||||
| Revision ID | string | No | — | The revision ID to use with the selected revision control mode. (shown when Revision Control is targetRevisionId, requiredRevisionId) |
All Operations
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Authentication | options | No | oAuth2 | Authentication method to use. |
Options: oAuth2 (OAuth2, recommended), serviceAccount (Service Account) | ||||
| Google Account | credential | No | — | Connect or select your Google account. (shown when Authentication is oAuth2) |
| Service Account Email | string | Yes | — | The email address of the Google service account, for example my-service-account@project.iam.gserviceaccount.com. (shown when Authentication is serviceAccount) |
| Private Key | string | Yes | — | The private key from the service account JSON key file. Paste the full PEM block, including the BEGIN and END lines. (shown when Authentication is serviceAccount) |
| Max Concurrency | number | No | 5 | Maximum number of items to process concurrently. Between 1 and 20. |
Output Data
Exactly one output item per input item — no operation fans out. The API response is merged into the item JSON, so the incoming fields pass through except where a response field uses the same name, and binary data on the input item is forwarded unchanged.
What lands on the item depends on the operation:
| Operation | Result on the output item |
|---|---|
create | The Drive file record returned for the new document. |
get, Simplify on | documentId and content — the document’s paragraph text extracted to a single plain-text string. |
get, Simplify off | The raw Docs API document JSON. |
update, Simplify on | The first non-empty entry from the batch replies, plus documentId. An update whose actions produce no replies returns documentId alone. |
update, Simplify off | The full batchUpdate response, plus documentId. |
Reference the result downstream by expression, e.g. {{ $json.content }} or {{ $json.documentId }}.
Usage Examples
- Create a new blank Google Doc in a specific Drive folder
- Get the full raw JSON of a Google Doc
- Get just the plain text content from a Google Doc
- Insert text at the end of a Google Doc
- Replace all occurrences of a placeholder text in a document
- Add a header or footer to a document
- Insert a table into a document
- Create a named range across a range of characters
- Delete paragraph bullets from a range
- Insert a page break at a specific index
Example Configuration
Create a new document inside a Drive folder:
{
"type": "google_docs",
"parameters": {
"authentication": "oAuth2",
"resource": "document",
"operation": "create",
"title": "{{ $json.title }}",
"folderId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
}
}
Read a document’s plain text so downstream nodes can process it:
{
"type": "google_docs",
"parameters": {
"resource": "document",
"operation": "get",
"documentURL": "{{ $json.docUrl }}",
"simple": true
}
}
Append text to the end of the document body:
{
"type": "google_docs",
"parameters": {
"resource": "document",
"operation": "update",
"documentURL": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
"actionsUi": {
"actionFields": [
{
"object": "text",
"action": "insert",
"insertSegment": "body",
"locationChoice": "endOfSegmentLocation",
"text": "{{ $json.summary }}\n"
}
]
},
"simple": true
}
}
Fill a template by replacing a placeholder, then append a 3x2 table. Use a non-mustache placeholder such as [[CUSTOMER_NAME]] in the template — {{ … }} is reserved for workflow expressions and would be evaluated before the request is sent:
{
"type": "google_docs",
"parameters": {
"resource": "document",
"operation": "update",
"documentURL": "{{ $json.documentId }}",
"actionsUi": {
"actionFields": [
{
"object": "text",
"action": "replaceAll",
"text": "[[CUSTOMER_NAME]]",
"replaceText": "{{ $json.customerName }}",
"matchCase": false
},
{
"object": "table",
"action": "insert",
"insertSegment": "body",
"locationChoice": "endOfSegmentLocation",
"rows": 3,
"columns": 2
}
]
},
"writeControlType": "none"
}
}
Error Handling
| Mode | Behavior |
|---|---|
| stop | Halts workflow on first error |
| continue | Skips failed items, passes successful ones through |
| errorPort | Routes failed items to Error output port |
Tips
Create, get, and update Google Docs documents using the Google Docs and Drive APIs.
Frequently asked questions
What authentication options does this node support?
You can authenticate with either a Google Docs OAuth2 credential (googleDocsOAuth2Api), which works well for user-level access, or a Google API Service Account credential (googleApi), which is better suited for server-side automation where no human login is involved. You'll set up one of these two before the node can make any API calls.
When I use the 'get' operation, what exactly comes back?
The get operation has two modes controlled by the 'simple' toggle. With simple=true, the node extracts plain text from the document's body paragraphs and returns it as a readable string — useful when you just need the content. With simple=false, you get the raw JSON response from the Google Docs API, which includes full structural detail like paragraph styles, named ranges, and inline objects.
How do I target a specific document? Does it need to be just the ID?
No — you can paste either a raw document ID or a full Google Docs URL (e.g. https://docs.google.com/document/d/DOCUMENT_ID/edit). The node parses the URL and extracts the ID automatically, so you don't need to strip it down yourself.
What kinds of changes can the 'update' operation make to a document?
Update sends a batchUpdate request to the Docs API and supports a wide range of actions: inserting or replacing text, creating and deleting headers and footers, inserting page breaks, creating named ranges, inserting tables plus individual rows and columns, managing paragraph bullet styles, and deleting positioned objects. You build a list of these actions in a fixedCollection, and they're all sent in a single API call. You can also include a writeControl value (targetRevisionId or requiredRevisionId) to guard against conflicting edits.
Can I create a document inside a specific folder or shared drive?
Yes. The create operation accepts an optional folderId to place the new document in a particular Drive folder, and an optional driveId for Shared Drive targets. Under the hood it calls the Drive API (v3) with a mimeType of application/vnd.google-apps.document, so the result is a native Google Doc rather than an uploaded file.
Build with the Google Docs node
Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need Google Docs OAuth2 credentials first.
Open BusyBotLast updated . Spotted something wrong? Tell us.