Google Docs
connector.google_docs · productivity, documents
Create documents, read them as structured JSON or plain text, and edit them with batch updates.
Vendor API documentation: https://developers.google.com/workspace/docs/api/reference/rest
Authentication
| Method | Credential kind | Auth kind | Fields | Test request |
|---|---|---|---|---|
| Google account (OAuth2) | google_docs/oauth2 | oauth2_auth_code | client_id, client_secret (secret) | yes |
| Google service account | google_docs/service_account | jwt_service_account | client_email, private_key (secret), subject | yes |
Actions
Node type connector.google_docs. Choose a resource and an operation; each operation has its own parameters.
Document
| Operation | ID | Effect | Paginated | Cassette tests |
|---|---|---|---|---|
| Create a document | document.create | writes | 2 | |
| Get a document | document.get | reads | 2 | |
| Get document text | document.get_text | reads | 1 | |
| Update a document | document.update | writes | 4 |
Create a document
Operation document.create. Creates a document, optionally inside a Drive folder and with initial text.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
title | string | yes | |||
folder | resource_locator | "root" | Drive folder (or shared drive folder) to create the document in. Values from lookup folders. | ||
content | string | Initial text. Text inserted into the new document body. |
Get a document
Operation document.get. Returns the full document structure.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
document | resource_locator | yes | Document ID, or a docs.google.com document URL. Values from lookup documents. | ||
include_tabs | boolean | false | Include all tabs. | ||
suggestions_view_mode | options | One of DEFAULT_FOR_CURRENT_ACCESS, SUGGESTIONS_INLINE, PREVIEW_SUGGESTIONS_ACCEPTED, PREVIEW_WITHOUT_SUGGESTIONS. |
Get document text
Operation document.get_text. Returns the title and the body as plain text (table cells separated by tabs).
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
document | resource_locator | yes | Document ID, or a docs.google.com document URL. Values from lookup documents. |
Update a document
Operation document.update. Applies a list of edits: insert text, a page break or a table (at the end or at an index), replace all occurrences of a text, or delete a content range. Each edit is sent as its own batch update in order. Pass raw Docs API requests to send one atomic batch instead.
| Name | Type | Default | Required | Shown when | Description |
|---|---|---|---|---|---|
document | resource_locator | yes | Document ID, or a docs.google.com document URL. Values from lookup documents. | ||
actions | fixed_collection | Edits applied in order. Indexes are UTF-16 offsets as reported by Get a document. | |||
actions.action | options | "insert" | One of insert, replaceAll, delete. | ||
actions.object | options | "text" | One of text, pageBreak, table, contentRange. | ||
actions.text | string | Text to insert, or the text to find for Replace all. | |||
actions.replaceText | string | Replace with. | |||
actions.matchCase | boolean | false | Match case. | ||
actions.searchByRegex | boolean | false | Use regular expression. | ||
actions.locationChoice | options | "endOfSegmentLocation" | Insert at. One of endOfSegmentLocation, location. | ||
actions.index | number | ||||
actions.startIndex | number | ||||
actions.endIndex | number | ||||
actions.rows | number | ||||
actions.columns | number | ||||
actions.segmentId | string | Header/footer/footnote ID. | |||
actions.tabId | string | Tab ID. | |||
requests | json | Raw requests. Array of Docs API Request objects sent as one batch. Used instead of the edits list. | |||
write_control | options | One of requiredRevisionId, targetRevisionId. | |||
revision_id | string |
Lookups
Lookups fill dropdowns and resource pickers in the editor from the vendor API.
| Lookup | Depends on | Search | Description |
|---|---|---|---|
documents | client-side | {{ item.modifiedTime }} | |
folders | client-side |
Import
Exported workflows that use these node types import to this node. Unverified ranges import with a parameter warning until parity fixtures confirm them; see Migrating.
| Source type | Version range | Status | Fixtures |
|---|---|---|---|
n8n-nodes-base.googleDocs | >=1 <3 | unverified |
Provenance
Written from the vendor’s documentation:
- https://developers.google.com/workspace/docs/api/reference/rest
- https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/create
- https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/get
- https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/batchUpdate
- https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request
- https://developers.google.com/workspace/docs/api/how-tos/move-text
- https://developers.google.com/workspace/docs/api/how-tos/merge
- https://developers.google.com/workspace/docs/api/how-tos/best-practices
- https://developers.google.com/workspace/docs/api/limits
- https://developers.google.com/workspace/docs/api/auth
- https://docs.googleapis.com/$discovery/rest?version=v1
- https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create
- https://developers.google.com/workspace/drive/api/reference/rest/v3/files/list
- https://developers.google.com/workspace/drive/api/guides/search-files
- https://developers.google.com/identity/protocols/oauth2/web-server
- https://developers.google.com/identity/protocols/oauth2/service-account