# Google Sheets

Google Sheets is a cloud-based spreadsheet application that enables users to create, edit, and share spreadsheets from any device. It offers real-time collaboration, powerful data analysis tools, and seamless integration with other Google services.

### **How to Integrate Google Sheets with ZBrain Flow** <a href="#how-to-integrate-google-sheets-with-zbrain-flow" id="how-to-integrate-google-sheets-with-zbrain-flow"></a>

To integrate Google Sheets with ZBrain Flow:

1. Click the ‘+’ button in ZBrain Flow.
2. Type "Google Sheets" in the search bar and select it from the available options.
3. Choose an action to begin the setup process.

### **How to Connect Google Sheets to ZBrain Flow** <a href="#how-to-connect-google-sheets-to-zbrain-flow" id="how-to-connect-google-sheets-to-zbrain-flow"></a>

To establish a connection between Google Sheets and ZBrain Flow:

1. **Enter a Connection Name** – Provide a name for easy identification.
2. **Click ‘Connect’** – Start the authentication process.
3. **Log in to Google Sheets** – A pop-up window will appear for Google login.
4. **Grant Permissions** – Approve the required permissions to allow ZBrain Flow access.
5. **Save the Connection** – Click **‘**&#x53;av&#x65;**’** to finalize the setup.

Once connected, ZBrain Flow can interact with Google Sheets to retrieve, update, delete, and automate spreadsheet operations.

### **Where to Find Spreadsheet ID, Sheet ID, and Parent Folder in Google Sheets** <a href="#where-to-find-spreadsheet-id-sheet-id-and-parent-folder-in-google-sheets" id="where-to-find-spreadsheet-id-sheet-id-and-parent-folder-in-google-sheets"></a>

1. **Spreadsheet ID:**
   * Open your Google Sheet in a browser.
   * Look at the URL in the address bar. The Spreadsheet ID is the long alphanumeric string between `/d/` and `/edit`.
   * Example:

     `https://docs.google.com/spreadsheets/d/1A2B3C4D5E6F7G8H9I0J123456789abcdef/edit#gid=0`

     * The Spreadsheet ID is `1A2B3C4D5E6F7G8H9I0J123456789abcdef`.
2. **Sheet ID:**
   * Each tab in a spreadsheet has a unique Sheet ID.
   * Find it at the end of the URL after `#gid=`.
   * Example:

     `https://docs.google.com/spreadsheets/d/1A2B3C4D5E6F7G8H9I0J123456789abcdef/edit#gid=123456789`

     * The Sheet ID is `123456789`.
3. **Parent Folder (For Creating a New Spreadsheet in a Specific Folder):**
   * Open Google Drive.
   * Navigate to the folder where you want to create a new spreadsheet.
   * Copy the folder ID from the URL (the alphanumeric string after `/folders/`).
   * Example:

     `https://drive.google.com/drive/folders/1B2C3D4E5F6G7H8I9J0K`

     * The Parent Folder ID is `1B2C3D4E5F6G7H8I9J0K`.

### **Switch Descriptions in Google Sheets Actions** <a href="#switch-descriptions-in-google-sheets-actions" id="switch-descriptions-in-google-sheets-actions"></a>

| **Switch Name**                         | **Description**                                                                                                       |
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **Include Team Drive Sheets?**          | Includes spreadsheets from Google Team Drives (shared drives) in actions.                                             |
| **As String**                           | Inserts values (dates and formulas) as plain text instead of processing them.                                         |
| **Does the first row contain headers?** | Treats the first row as column headers for mapping data.                                                              |
| **Overwrite Existing Data?**            | Replaces all existing data in the sheet with new input data.                                                          |
| **Avoid Duplicates?**                   | Checks for duplicate values before inserting new rows, ensuring only unique entries are added.                        |
| **Exact Match?**                        | Searches for an exact match of the specified value instead of partial matches.                                        |
| **Is First Row Headers?**               | Specifies whether the first row contains headers to properly format data retrieval.                                   |
| **Memory Key**                          | Stores the last processed row number, allowing the automation to resume from the correct position in subsequent runs. |

### **Actions Available in ZBrain Flow** <a href="#actions-available-in-zbrain-flow" id="actions-available-in-zbrain-flow"></a>

#### **1. Insert Row** <a href="#id-1.-insert-row" id="id-1.-insert-row"></a>

The Insert Row feature allows users to append a row of values to an existing Google Sheet, enabling seamless data entry and automated record keeping.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the Spreadsheet ID:** Provide the unique identifier of the target spreadsheet.
4. **Enter the Sheet ID:** Specify the ID of the worksheet within the spreadsheet.
5. **As String:** Enable/Disable this switch to determine if inserted values that are dates and formulas will be entered as strings without being evaluated.
6. **Does the first row contain headers?:** Enable/Disable this switch to indicate if the first row contains column headers.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **2. Insert Multiple Rows** <a href="#id-2.-insert-multiple-rows" id="id-2.-insert-multiple-rows"></a>

The Insert Multiple Rows feature enables users to add one or more new rows to a specific spreadsheet, facilitating batch data entry and automated data population.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the Spreadsheet ID:** Provide the unique identifier of the target spreadsheet.
4. **Enter the Sheet ID:** Specify the ID of the worksheet within the spreadsheet.
5. **Enter the rows input format:** Select the format of the input values to be inserted into the sheet. Choose between CSV, JSON, or column names.
6. **Overwrite Existing Data?:** Enable/Disable this switch to replace all existing data in the sheet with new data from your input. This will clear any extra rows beyond the updated range.
7. **Avoid Duplicates?:** Enable/Disable this switch to check for duplicate values before inserting data into the sheet. Only unique rows will be added based on the selected column.
8. **As String:** Enable/Disable this switch to determine if inserted values that are dates and formulas will be entered as strings without being evaluated.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **3. Delete Row** <a href="#id-3.-delete-row" id="id-3.-delete-row"></a>

The Delete Row feature allows users to remove a specific row from an existing sheet, enabling data cleanup and automated record management.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the Spreadsheet ID:** Provide the unique identifier of the target spreadsheet.
4. **Enter the Sheet ID:** Specify the ID of the worksheet within the spreadsheet.
5. **Enter the Row number to remove:** Specify the exact row number to be deleted from the sheet.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **4. Update Row** <a href="#id-4.-update-row" id="id-4.-update-row"></a>

The Update Row feature enables users to overwrite values in an existing row, allowing for data modifications and corrections within automated workflows.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the Spreadsheet ID:** Provide the unique identifier of the target spreadsheet.
4. **Enter the Sheet ID:** Specify the ID of the worksheet within the spreadsheet.
5. **Enter the Row number to update:** Specify the exact row number to be updated.
6. **Does the first row contain headers?:** Enable/Disable this switch to indicate if the first row contains column headers.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **5. Find Rows** <a href="#id-5.-find-rows" id="id-5.-find-rows"></a>

The Find Rows feature allows users to locate specific rows in a Google Sheet based on column values, enabling data retrieval and conditional processing.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the Spreadsheet ID:** Provide the unique identifier of the target spreadsheet.
4. **Enter the Sheet ID:** Specify the ID of the worksheet within the spreadsheet.
5. **Enter the name of the column to search in:** Specify which column should be examined for the search value.
6. **Enter the search value:** Provide the value to search for in the specified column. If left empty, all rows will be returned.
7. **Exact match:** Enable/Disable this switch to determine whether to choose rows with an exact match or rows that contain the search value.
8. **Enter the starting row:** Specify the row number to start searching from.
9. **Enter the number of rows:** Specify how many matching rows to return. The default is 1 if not specified.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **6. Create Spreadsheet** <a href="#id-6.-create-spreadsheet" id="id-6.-create-spreadsheet"></a>

The Create Spreadsheet feature enables users to generate a new blank spreadsheet, facilitating the creation of new data repositories within automated workflows.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Enter the title of the new spreadsheet:** Provide a name for the new spreadsheet.
3. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
4. **Enter the parent folder:** Specify the folder to create the worksheet in. By default, the new worksheet is created in the root folder of the drive.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### 7. Create Worksheet <a href="#id-7.-create-worksheet" id="id-7.-create-worksheet"></a>

The Create Worksheet feature allows users to add a new blank worksheet to an existing spreadsheet, enabling organized data management across multiple tabs.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet:** Provide the ID of the target spreadsheet.
4. **Enter the title of the new worksheet:** Specify a name for the new worksheet.
5. **Enter the headers:** Define column headers for the new worksheet. Click on '+ Add Item' to add more headers.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **8. Clear Sheet** <a href="#id-8.-clear-sheet" id="id-8.-clear-sheet"></a>

The Clear Sheet feature enables users to remove all data from an existing worksheet, facilitating data refresh and cleanup operations.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet:** Provide the ID of the target spreadsheet.
4. **Enter the ID of the sheet to use:** Specify the worksheet ID to be cleared.
5. **Is First row Headers?:** Enable/Disable this switch to indicate if the first row contains column headers that should be preserved.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **9. Get Row** <a href="#id-9.-get-row" id="id-9.-get-row"></a>

The Get Row feature allows users to retrieve a specific row from a Google Sheet by its row number, enabling targeted data extraction and processing.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet:** Provide the ID of the target spreadsheet.
4. **Enter the ID of the sheet to use:** Specify the worksheet ID to retrieve data from.
5. **Enter the row number to get from the sheet:** Specify the exact row number to retrieve.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **10. Get Next Rows** <a href="#id-10.-get-next-rows" id="id-10.-get-next-rows"></a>

The Get Next Rows feature enables users to retrieve batches of rows sequentially from a Google Sheet, facilitating pagination and processing of large datasets.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet:** Provide the ID of the target spreadsheet.
4. **Enter the ID of the sheet to use:** Specify the worksheet ID to retrieve data from.
5. **Enter the Start row:** Specify the row number to begin retrieval from.
6. **Enter the memory key:** Provide a key used to store the current row number in memory.
7. **Enter the group size:** Specify the number of rows to retrieve in each batch.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **11. Find Spreadsheets** <a href="#id-11.-find-spreadsheets" id="id-11.-find-spreadsheets"></a>

The Find Spreadsheets feature allows users to locate spreadsheets by name, enabling dynamic selection of data sources within automated workflows.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet name:** Provide the name of the spreadsheet to search for.
4. **Exact Match:** Enable/Disable this switch to determine if only spreadsheets exactly matching the name should be returned or if spreadsheets containing the name should be included.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **12. Find Worksheets** <a href="#id-12.-find-worksheets" id="id-12.-find-worksheets"></a>

The Find Worksheets feature enables users to locate specific worksheets within a spreadsheet by title, facilitating dynamic data operations across multiple tabs.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet:** Provide the ID of the target spreadsheet.
4. **Enter the title:** Specify the title of the worksheet to search for.
5. **Exact Match:** Enable/Disable this switch to determine if only worksheets exactly matching the title should be returned or if worksheets containing the title should be included.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **13. Copy Worksheet** <a href="#id-13.-copy-worksheet" id="id-13.-copy-worksheet"></a>

The Copy Worksheet feature allows users to duplicate an existing worksheet within the same spreadsheet or another, enabling template reuse and data backup.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet containing the worksheet to copy:** Provide the ID of the source spreadsheet.
4. **Enter the spreadsheet to paste in:** Specify the ID of the destination spreadsheet.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **14. Update Multiple Rows** <a href="#id-14.-update-multiple-rows" id="id-14.-update-multiple-rows"></a>

The Update Multiple Rows feature enables users to modify multiple rows in a spreadsheet simultaneously, facilitating batch updates and data transformations.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet ID:** Provide the unique identifier of the target spreadsheet.
4. **Enter the sheet ID:** Specify the ID of the worksheet within the spreadsheet.
5. **As String:** Enable/Disable this switch to determine if inserted values that are dates and formulas will be entered as strings without being evaluated.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **15. Create Spreadsheet Column** <a href="#id-15.-create-spreadsheet-column" id="id-15.-create-spreadsheet-column"></a>

The Create Spreadsheet Column feature allows users to add a new column to an existing worksheet, enabling data structure expansion and additional data capture.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Include Team Drive Sheets:** Enable/Disable this switch to determine if sheets from Team Drives should be included in the results.
3. **Enter the spreadsheet ID:** Provide the unique identifier of the target spreadsheet.
4. **Enter the sheet ID:** Specify the ID of the worksheet within the spreadsheet.
5. **Enter the column name:** Provide a name for the new column.
6. **Enter the column index:** Specify the position for the new column.
   * The column index starts from 1. For example, if you want to add a column to the third position, enter 3.
   * If the input is less than 1, the column will be added after the last current column.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.

#### **16. Custom API Call** <a href="#id-16.-custom-api-call" id="id-16.-custom-api-call"></a>

The Custom API Call feature enables users to interact directly with the Google Sheets API, allowing for advanced operations and custom integrations beyond standard actions.

**Configuration Steps:**

1. **Select an Existing Connection or Create a New One:** Choose an existing connection or establish a new one.
2. **Enter the URL:** You can use the full URL or the relative path to the base URL.
3. **Select the HTTP Method:** Choose the request type that aligns with your action:
   * **GET** – Retrieve file or folder details.
   * **POST** – Upload new files or create folders.
   * **PATCH** – Modify file metadata or update folder permissions.
   * **PUT** – Replace existing content in a file.
   * **DELETE** – Remove a file or folder permanently.
   * **HEAD** – Fetch response headers only without retrieving the actual data.
4. **Add Headers:** Define any additional headers required for the API request. Authorization headers are automatically injected. Click '+ Add Item' to include more headers.
5. **Add Query Parameters:** Customize API requests with query parameters to filter results or specify additional options. Click '+ Add Item' to add more parameters.
6. **Enter JSON Body:** Provide structured request data in JSON format.
7. **Set Timeout (in Seconds):** Define the request timeout duration to prevent long-running API calls from stalling the process.

**Note:** Click *'f'* to insert dynamic values for flexible configurations.
