> For the complete documentation index, see [llms.txt](https://docs.kognitos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kognitos.com/guides/platform/integrations/docs.md).

# Google Docs

{% hint style="info" %}
The following documentation is for **Google Docs v2.10.1**.
{% endhint %}

## Overview

Google Docs provides collaborative document creation and editing with real-time synchronization across teams. This integration enables automated document generation, content management, and collaborative writing workflows. Enhance documentation processes and improve team collaboration on shared documents.

## Setup

The following integrations need to be connected to your Kognitos workspace:

* **Google Docs**

### Steps

Follow these steps to connect the integration in Kognitos:

{% stepper %}
{% step %}

#### Navigate

Using the left navigation menu, go to **Integrations** → **Explore Integrations**.
{% endstep %}

{% step %}

#### Find

Search for the integration and click on it.
{% endstep %}

{% step %}

#### Connect

Click on <kbd>**Connect**</kbd> to add a connection to the integration.
{% endstep %}

{% step %}

#### Configure

Add a name for the connection. You'll be prompted for [**authentication**](#authentication) details if needed. Then, click on <kbd>**Connect**</kbd>.
{% endstep %}
{% endstepper %}

## Authentication

Use one of the following authentication methods to connect this integration in Kognitos. Each method has its own configuration requirements.

### Connect using Client Email, Token URI and Private Key

Gets the credentials from the service account keys.

| Label        | Description                                                                     | Type        |
| ------------ | ------------------------------------------------------------------------------- | ----------- |
| Client Email | The client email of the service account registered in the Google Cloud Console. | `text`      |
| Token URI    | The token URI of the Google Cloud Console.                                      | `text`      |
| Private Key  | The private key of the service account registered in the Google Cloud Console.  | `sensitive` |

### Continue with Google

To connect to the **Google Docs** book, click on <kbd>Continue with Google</kbd>. This will redirect you to Google's secure authentication page where you can sign in with your Google account and authorize the application. Once connected, the Kognitos agent will have access to your Google Docs while keeping your credentials secure.

## Actions

The following actions are available in the **Google Docs** integration:

### 1. Add a paragraph to a document

Add a new paragraph to the end of a document.

### 2. Batch update document

Apply raw Google Docs batch update requests to a document.

### 3. Create a google document in a folder

Creates a new Google Docs document.

### 4. Find a document text range in a document

Find the index range of exact text in a document.

### 5. Get a document paragraph from a document

Resolve the paragraph containing a document index.

### 6. Get a document from docs

Get the full Google Docs document.

### 7. Get some document comments from a document

Get comments and replies for a Google Docs document.

### 8. Get some document tables from a document

Extract the table structures and cell text from a document.

### 9. Get some document text blocks from a document

Get the document paragraph text with document indexes.

### 10. Insert a heading in a document

Insert a heading at the end of a document.

### 11. Overwrite a document

Replace the main body content of a document.

### 12. Replace text in a document

Replace exact text everywhere it appears in a document.

## Concepts

### Google drive file reference

Contains all information required to identify a file in Google Drive.

| Field Name                 | Description                   | Type           |
| -------------------------- | ----------------------------- | -------------- |
| `id`                       | The id of the file            | `text`         |
| `file_name`                | The name of the file          | `text`         |
| [`parents`](#list-of-text) | The ids of the parent folders | `list of text` |

### Google drive folder reference

Contains all information required to identify a folder in Google Drive.

| Field Name                 | Description                   | Type           |
| -------------------------- | ----------------------------- | -------------- |
| `id`                       | The id of the folder          | `text`         |
| `folder_name`              | The name of the folder        | `text`         |
| [`parents`](#list-of-text) | The ids of the parent folders | `list of text` |

### Google docs range

A range inside a Google document.

| Field Name    | Description                                | Type             |
| ------------- | ------------------------------------------ | ---------------- |
| `start_index` | The inclusive start index in the document. | `number`         |
| `end_index`   | The exclusive end index in the document.   | `number`         |
| `text`        | Optional text contained in the range.      | `optional[text]` |

### Google docs document

A normalized Google document.

| Field Name                             | Description                            | Type                                      |
| -------------------------------------- | -------------------------------------- | ----------------------------------------- |
| `id`                                   | The document identifier.               | `text`                                    |
| `title`                                | The document title.                    | `text`                                    |
| `revision_id`                          | Optional document revision identifier. | `optional[text]`                          |
| `text`                                 | The flattened document text.           | `optional[text]`                          |
| [`paragraphs`](#google-docs-paragraph) | The document paragraphs.               | `optional[list of google docs paragraph]` |
| [`tables`](#google-docs-table)         | The document tables.                   | `optional[list of google docs table]`     |

### Google docs paragraph

A paragraph extracted from a Google document.

| Field Name        | Description                                | Type             |
| ----------------- | ------------------------------------------ | ---------------- |
| `text`            | The paragraph text.                        | `text`           |
| `start_index`     | The inclusive start index in the document. | `number`         |
| `end_index`       | The exclusive end index in the document.   | `number`         |
| `paragraph_style` | Optional paragraph style name.             | `optional[text]` |

### Google docs table

A table extracted from a Google document.

| Field Name                       | Description            | Type                                      |
| -------------------------------- | ---------------------- | ----------------------------------------- |
| `start_index`                    | The table start index. | `number`                                  |
| `end_index`                      | The table end index.   | `number`                                  |
| [`rows`](#google-docs-table-row) | The table rows.        | `optional[list of google docs table row]` |

### Google docs comment

A Google document comment.

| Field Name                              | Description                             | Type                                          |
| --------------------------------------- | --------------------------------------- | --------------------------------------------- |
| `id`                                    | The comment identifier.                 | `text`                                        |
| `author`                                | The display name of the comment author. | `optional[text]`                              |
| `content`                               | The comment content.                    | `optional[text]`                              |
| `created_time`                          | When the comment was created.           | `optional[text]`                              |
| `modified_time`                         | When the comment was last modified.     | `optional[text]`                              |
| `resolved`                              | Whether the comment is resolved.        | `optional[boolean]`                           |
| [`replies`](#google-docs-comment-reply) | The replies to the comment.             | `optional[list of google docs comment reply]` |

### Google docs comment reply

A reply to a Google document comment.

| Field Name      | Description                           | Type             |
| --------------- | ------------------------------------- | ---------------- |
| `id`            | The reply identifier.                 | `text`           |
| `author`        | The display name of the reply author. | `optional[text]` |
| `content`       | The reply content.                    | `optional[text]` |
| `created_time`  | When the reply was created.           | `optional[text]` |
| `modified_time` | When the reply was last modified.     | `optional[text]` |

### Google docs text block

A text block extracted from a Google document.

| Field Name        | Description                                | Type             |
| ----------------- | ------------------------------------------ | ---------------- |
| `text`            | The text content.                          | `text`           |
| `start_index`     | The inclusive start index in the document. | `number`         |
| `end_index`       | The exclusive end index in the document.   | `number`         |
| `paragraph_style` | Optional paragraph style name.             | `optional[text]` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kognitos.com/guides/platform/integrations/docs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
