Skip to main content

Google Docs

Type ID: googleDocs  ·  Kind: Action  ·  Trace: TOOL

Create and update documents using the Google Docs API.

Credentials

Google Docs

Resources & operations

  • Document (document)
    • Create (create) — Create a document
    • Get (get) — Fetch a document
    • Replace Text (replaceText) — Replace all matching text in a document
    • Append Text (appendText) — Append text to the end of a document

Properties

Common

PropertyKeyTypeRequiredDefaultPossible valuesShown when
ResourceresourceoptionsNodocumentDocument (document)
OperationoperationoptionsNocreateCreate (create), Get (get), Replace Text (replaceText), Append Text (appendText)resource = document

Document → Create

PropertyKeyTypeRequiredDefaultPossible valuesShown when
TitletitlestringYes''Title for the new Google documentresource = document, operation = create

Document → Get

PropertyKeyTypeRequiredDefaultPossible valuesShown when
Document IDdocumentIdstringYes''Google Docs document IDresource = document, operation = get
Include Tabs ContentincludeTabsContentbooleanNotruetrue / falseresource = document, operation = get
FieldsfieldsstringNo''Optional response field mask (e.g. title,revisionId,body.content)resource = document, operation = get

Document → Replace Text

PropertyKeyTypeRequiredDefaultPossible valuesShown when
Document IDdocumentIdstringYes''Google Docs document IDresource = document, operation = replaceText
Search TextsearchTextstringYes''Exact placeholder or text to replaceresource = document, operation = replaceText
Replacement TextreplacementTextstringNo''Text to replace every matching occurrence withresource = document, operation = replaceText
Additional FieldsadditionalFieldsobjectNo{}Collection (see below)resource = document, operation = replaceText

additionalFields collection options (Replace Text):

PropertyKeyTypeRequiredDefaultPossible values
Match CasematchCasebooleanNotruetrue / false
Required Revision IDrequiredRevisionIdstringNo''Fail if the document revision does not match this revision id
Target Revision IDtargetRevisionIdstringNo''Apply the change against this target revision id when possible

Document → Append Text

PropertyKeyTypeRequiredDefaultPossible valuesShown when
Document IDdocumentIdstringYes''Google Docs document IDresource = document, operation = appendText
TexttextstringYes''Text to append at the end of the documentresource = document, operation = appendText
Additional FieldsadditionalFieldsobjectNo{}Collection (see below)resource = document, operation = appendText

additionalFields collection options (Append Text):

PropertyKeyTypeRequiredDefaultPossible values
Required Revision IDrequiredRevisionIdstringNo''Fail if the document revision does not match this revision id
Target Revision IDtargetRevisionIdstringNo''Apply the change against this target revision id when possible

Notes

  • Requires a Google Docs credential; the credential ID is read from credentials.id and resolved to an OAuth bearer token. A missing token raises Workflow error, credentials missing.
  • All requests go to https://docs.googleapis.com/v1 with Authorization: Bearer <token>. Errors throw Google Docs API request failed (<status>): <message>.
  • Create posts { title } to /documents. Output: { success: true, documentId, title, revisionId, document }.
  • Get calls GET /documents/{documentId} with includeTabsContent and an optional fields mask query param. Output: { success: true, documentId, title, revisionId, document }.
  • Replace Text posts a replaceAllText request to /documents/{documentId}:batchUpdate using containsText.{text, matchCase} and replaceText. A writeControl is added when requiredRevisionId or targetRevisionId is set (required takes precedence). It sums occurrencesChanged across replies. Output: { success: true, documentId, occurrencesChanged, replies, response }.
  • Append Text posts an insertText request to /documents/{documentId}:batchUpdate with endOfSegmentLocation: {} and the given text; same writeControl handling as Replace Text. Output: { success: true, documentId, replies, response }.