ByteChef LogoByteChef

Google Docs

Google Docs is a cloud-based collaborative word processing platform that allows multiple users to create, edit, and share documents in real-time.

Categories: File Storage

Type: googleDocs/v1


Connections

Version: 1

OAuth2 Authorization Code

Properties

NameLabelTypeDescriptionRequired
clientIdClient IdSTRINGtrue
clientSecretClient SecretSTRINGtrue

Connection Setup

Create OAuth 2.0 Application

Creation of OAuth 2.0 application is documented here.

Enable Google Docs API

  1. In the Google Cloud Console, select your project.
  2. Go to the APIs & Services.
  3. Click on ENABLE APIS AND SERVICES.
  4. Search for "google docs api" in the search bar.
  5. Click on Google Docs API.
  6. Click Enable.

Actions

Create Document

Name: createDocument

Create a document on Google Docs.

Properties

NameLabelTypeDescriptionRequired
titleTitleSTRINGThe title of the document.true
bodyContentSTRINGContent of the document.true

Example JSON Structure

{
  "label" : "Create Document",
  "name" : "createDocument",
  "parameters" : {
    "title" : "",
    "body" : ""
  },
  "type" : "googleDocs/v1/createDocument"
}

Output

Type: OBJECT

Properties

NameTypeDescription
documentIdSTRINGThe ID of the document.
titleSTRINGThe title of the document.
tabsARRAY
Items [{{STRING(tabId), STRING(title), STRING(parentTabId), INTEGER(index), INTEGER(nestingLevel), STRING(iconEmoji)}(tabProperties), [{}](childTabs)}]
Tabs that are part of a document.
revisionIdSTRINGThe revision ID of the document.
suggestionsViewModeSTRINGThe suggestions view mode applied to the document.
bodyOBJECT
Properties {[{INTEGER(startIndex), INTEGER(endIndex)}](content)}
The main body of the document.

Output Example

{
  "documentId" : "",
  "title" : "",
  "tabs" : [ {
    "tabProperties" : {
      "tabId" : "",
      "title" : "",
      "parentTabId" : "",
      "index" : 1,
      "nestingLevel" : 1,
      "iconEmoji" : ""
    },
    "childTabs" : [ { } ]
  } ],
  "revisionId" : "",
  "suggestionsViewMode" : "",
  "body" : {
    "content" : [ {
      "startIndex" : 1,
      "endIndex" : 1
    } ]
  }
}

Create Document From Template

Name: createDocumentFromTemplate

Creates a new document based on an existing one and can replace any placeholder variables found in your template document, like [[name]], [[email]], etc.

Properties

NameLabelTypeDescriptionRequired
fileIdTemplate Document IDSTRINGThe ID of the template document from which the new document will be created.true
placeholderFormatPlaceholder FormatSTRING
Options {{}}, [[]]
Choose the format of placeholders in your template.true
fileNameTitle of New DocumentSTRINGName of the new document.true
folderIdFolder IDSTRINGID of the folder where the new document will be saved. If not provided, the new document will be saved in the same folder as the template document.false
valuesVariablesOBJECT
Properties {}
Don't include the "[[]]", only the key name and its value.false

Example JSON Structure

{
  "label" : "Create Document From Template",
  "name" : "createDocumentFromTemplate",
  "parameters" : {
    "fileId" : "",
    "placeholderFormat" : "",
    "fileName" : "",
    "folderId" : "",
    "values" : { }
  },
  "type" : "googleDocs/v1/createDocumentFromTemplate"
}

Output

Type: OBJECT

Properties

NameTypeDescription
documentIdSTRINGThe ID of the document.
titleSTRINGThe title of the document.
tabsARRAY
Items [{{STRING(tabId), STRING(title), STRING(parentTabId), INTEGER(index), INTEGER(nestingLevel), STRING(iconEmoji)}(tabProperties), [{}](childTabs)}]
Tabs that are part of a document.
revisionIdSTRINGThe revision ID of the document.
suggestionsViewModeSTRINGThe suggestions view mode applied to the document.
bodyOBJECT
Properties {[{INTEGER(startIndex), INTEGER(endIndex)}](content)}
The main body of the document.

Output Example

{
  "documentId" : "",
  "title" : "",
  "tabs" : [ {
    "tabProperties" : {
      "tabId" : "",
      "title" : "",
      "parentTabId" : "",
      "index" : 1,
      "nestingLevel" : 1,
      "iconEmoji" : ""
    },
    "childTabs" : [ { } ]
  } ],
  "revisionId" : "",
  "suggestionsViewMode" : "",
  "body" : {
    "content" : [ {
      "startIndex" : 1,
      "endIndex" : 1
    } ]
  }
}

Find Document ID

To find the Document ID, click here.

Find Folder ID

To find the Folder ID, click here.

Get Document

Name: getDocument

Gets the latest version of the specified document.

Properties

NameLabelTypeDescriptionRequired
documentIdDocument IdSTRINGThe ID of the document to read.true

Example JSON Structure

{
  "label" : "Get Document",
  "name" : "getDocument",
  "parameters" : {
    "documentId" : ""
  },
  "type" : "googleDocs/v1/getDocument"
}

Output

Type: OBJECT

Properties

NameTypeDescription
documentIdSTRINGThe ID of the document.
titleSTRINGThe title of the document.
tabsARRAY
Items [{{STRING(tabId), STRING(title), STRING(parentTabId), INTEGER(index), INTEGER(nestingLevel), STRING(iconEmoji)}(tabProperties), [{}](childTabs)}]
Tabs that are part of a document.
revisionIdSTRINGThe revision ID of the document.
suggestionsViewModeSTRINGThe suggestions view mode applied to the document.
bodyOBJECT
Properties {[{INTEGER(startIndex), INTEGER(endIndex)}](content)}
The main body of the document.

Output Example

{
  "documentId" : "",
  "title" : "",
  "tabs" : [ {
    "tabProperties" : {
      "tabId" : "",
      "title" : "",
      "parentTabId" : "",
      "index" : 1,
      "nestingLevel" : 1,
      "iconEmoji" : ""
    },
    "childTabs" : [ { } ]
  } ],
  "revisionId" : "",
  "suggestionsViewMode" : "",
  "body" : {
    "content" : [ {
      "startIndex" : 1,
      "endIndex" : 1
    } ]
  }
}

Find Document ID

To find the Document ID, click here.

What to do if your action is not listed here?

If this component doesn't have the action you need, you can use Custom Action to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.

To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.


Additional Instructions

How to find Document ID

To find a Document ID, open the document in your browser. The ID is the long string of letters and numbers in the URL between /d/ and the next / (usually /edit).

For example, in the URL https://docs.google.com/document/d/1234567890abcdefghijklmnopqrstuvwxyz/edit, the Document ID is 1234567890abcdefghijklmnopqrstuvwxyz.

The Document ID can also be found in the output of the following actions:

  • Create Document
  • Create Document from Template
  • Get Document

How to find Folder ID

To find a Folder ID, open the Google Drive folder in your browser. The ID is the string of characters at the end of the URL after folders/.

For example, in the URL https://drive.google.com/drive/folders/abcjhadjh213102398890r4, the Folder ID is abcjhadjh213102398890r4.

The Folder ID can also be found in the output of the following Google Drive actions and triggers:

  • Create New Folder
  • Get File
  • List Folders
  • New Folder trigger

Troubleshooting

Access Blocked: Verification Process Not Completed

Documentation for how to add a test user can be found here

How is this guide?

Last updated on

On this page