# Google Docs

{% hint style="info" %}
The following documentation is for **Google Docs v2.0.1** *(BDK)*.
{% 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.

## Prerequisites

### 1. Required Books

The following Book(s) need to be added to your agent so it can learn and understand the automation procedures defined within them:

* **Google Docs**

#### How to Add the Book(s)

1. Go to **Books** → **All Books**.
2. Search for the name of the book and click on it.
3. Click on <kbd>**Install**</kbd> or <kbd>**Add Connection**</kbd> to add the book to your agent.
4. If adding a connection, you'll be prompted for [**connectivity**](#connectivity) details.

## Connectivity

This section outlines the available methods for connecting to the Book, along with the required configuration details for each.

### 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` |

## Procedures

### to add a paragraph to a (document)

Adds a new paragraph to the document.

**Input Concepts**

| Concept                                    | Description                      | Type                                                                  | Required | Default Value |
| ------------------------------------------ | -------------------------------- | --------------------------------------------------------------------- | -------- | ------------- |
| [`document`](#google-drive-file-reference) | The file to add the paragraph to | `google drive file reference`                                         | Yes      | (no default)  |
| `text`                                     | The new paragraph text.          | `text`                                                                | Yes      | (no default)  |
| `style`                                    | The new paragraph's style.       | `enum[heading_1, heading_2, heading_3, normal_text, subtitle, title]` | No       | (no default)  |

**Output Concepts**

| Concept                                    | Description                   | Type                          |
| ------------------------------------------ | ----------------------------- | ----------------------------- |
| [`document`](#google-drive-file-reference) | the document's file reference | `google drive file reference` |

**Examples**

Add a heading to a document

```generic
add a paragraph to the document where
    the text is "New paragraph"
    the style is "HEADING_1"
```

### to create a google document in a (folder)

Creates a new Google Docs document.

**Input Concepts**

| Concept                                    | Description                                       | Type                            | Required | Default Value |
| ------------------------------------------ | ------------------------------------------------- | ------------------------------- | -------- | ------------- |
| `name`                                     | The name for the new Google Docs document.        | `text`                          | Yes      | (no default)  |
| [`folder`](#google-drive-folder-reference) | The folder to create the Google Docs document in. | `google drive folder reference` | No       | (no default)  |

**Output Concepts**

| Concept                                  | Description                        | Type                          |
| ---------------------------------------- | ---------------------------------- | ----------------------------- |
| [`folder`](#google-drive-file-reference) | the new document's file reference. | `google drive file reference` |

**Examples**

Create a Google Docs document called "Hello World" in a folder

```generic
create a google document in the folder where
    the name is "Hello World"
```

## 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` |
