# GDocs

GDocs in StackAI allows you to automate the creation of Google Docs directly from your workflow. The **GDocs Node** integration streamlines document generation, making it easy to create, organize, and access Google Docs using dynamic data and AI-powered content.

***

**How to use it?**

To use the GDocs node, connect it in your StackAI workflow where you want to generate a new Google Doc. You can specify the document’s name, content (in Markdown), and optionally the folder where it should be stored in your Google Drive. The node will output the document’s unique ID and a direct link to open it.

***

**Example of Usage**

Suppose you want to generate a project report automatically after processing some data. You can use the GDocs node to create a new document titled "Project Report" with the body content generated by an LLM node, and save it in a specific Google Drive folder.

***

**Available Actions**

#### 1. Create Google Doc

**Description:**\
Creates a new Google Doc with specified content and file name, optionally placing it in a chosen Google Drive folder.

**Inputs:**

* **File Name** (Required):
  * Type: String
  * Description: Name of the Word document to create.
  * Example: `"Project Report"`
* **Content** (Required):
  * Type: String (Markdown)
  * Description: Document body text in Markdown format.
  * Example: `"## Executive Summary\nThis report covers..."`
* **Folder ID** (Optional):
  * Type: String
  * Description: Google Drive folder ID where the file will be created. Leave blank to create in My Drive.
  * Example: `"1A2B3C4D5E6F"`

**Configurations:**\
No additional configurations are required for this action.

**Outputs:**

* **File ID** (Required):
  * Type: String
  * Description: Unique identifier of the created Google Doc.
  * Example: `"1x2y3z4w5v6u"`
* **File URL** (Required):
  * Type: String
  * Description: URL to open the document in Google Drive.
  * Example: `"https://docs.google.com/document/d/1x2y3z4w5v6u/edit"`

***

**Example Workflow Step**

* Set up an LLM node to generate a summary.
* Connect the LLM output to the GDocs node’s Content input.
* Set File Name to "Weekly Summary".
* (Optional) Provide a Folder ID to organize the document.
* The GDocs node will output a File ID and a File URL for immediate access.

***

**Summary Table**

| Input Name | Required | Type   | Description                       | Example                   |
| ---------- | -------- | ------ | --------------------------------- | ------------------------- |
| File Name  | Yes      | String | Name of the document              | "Project Report"          |
| Content    | Yes      | String | Document body in Markdown         | "## Executive Summary..." |
| Folder ID  | No       | String | Google Drive folder ID (optional) | "1A2B3C4D5E6F"            |

| Output Name | Required | Type   | Description                                 | Example                           |
| ----------- | -------- | ------ | ------------------------------------------- | --------------------------------- |
| File ID     | Yes      | String | Unique identifier of the created Google Doc | "1x2y3z4w5v6u"                    |
| File URL    | Yes      | String | URL to open the document in Google Drive    | ",<https://docs.google.com/>,..." |

***

**Note:**\
To use this node, ensure your StackAI workspace is connected to Google Drive with the necessary permissions. Use the Folder ID to organize documents as needed, or leave it blank to save in your main Drive.
