> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Sheets integration

[Back to list of enterprise systems](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems.md)

Use the Google Sheets integration to create spreadsheets and worksheets, add and update rows, find and export data, format rows, and manage worksheets through Action Tools. It also provides triggers for new or updated rows, new rows, spreadsheets, and worksheets.

| Authentication | Actions | Triggers |
| - | - | - |
| OAuth 2.0 | ([21](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems/google-sheets#supported-actions)) | ([4](https://koreai.mintlify.site/agent-platform/integrations/enterprise-systems/google-sheets#triggers)) |

## Supported actions

| Action | Use it to |
| - | - |
| [Add Row](#add-row) | Add a row to a worksheet. |
| [Add Multiple Rows](#add-multiple-rows) | Add multiple rows, optionally replacing existing data or checking for duplicates. |
| [Update Row](#update-row) | Update a worksheet row. |
| [Update Multiple Rows](#update-multiple-rows) | Update multiple rows. |
| [Delete Row](#delete-row) | Delete a row. |
| [Find Rows](#find-rows) | Search rows by a column value. |
| [Create Spreadsheet](#create-spreadsheet) | Create a blank spreadsheet. |
| [Create Worksheet](#create-worksheet) | Add a worksheet to a spreadsheet. |
| [Clear Sheet](#clear-sheet) | Clear rows in a worksheet. |
| [Delete Worksheet](#delete-worksheet) | Permanently delete a worksheet. |
| [Rename Worksheet](#rename-worksheet) | Rename a worksheet. |
| [Format Row(s)](#format-rows) | Apply formatting to one or more rows. |
| [Get Single Row by ID](#get-single-row-by-id) | Retrieve a row by its number. |
| [Get next row(s)](#get-next-rows) | Retrieve the next group of rows and remember the current position. |
| [Get All Rows](#get-all-rows) | Retrieve all rows from a worksheet. |
| [Find Spreadsheet(s)](#find-spreadsheets) | Find spreadsheets by name. |
| [Find Worksheet(s)](#find-worksheets) | Find worksheets by title. |
| [Copy Worksheet](#copy-worksheet) | Copy a worksheet to a spreadsheet. |
| [Create Spreadsheet Column](#create-spreadsheet-column) | Add a column to a worksheet. |
| [Export Worksheet](#export-worksheet) | Export worksheet data as CSV or TSV. |
| [Custom API Call](#custom-api-call) | Call a Google Sheets API endpoint. |

## Triggers

| Trigger | Fires when |
| - | - |
| New or Updated Row | A row is added or modified in the selected spreadsheet and worksheet. Optionally limit the trigger to changes in a selected column. Google may delay the trigger by up to 3 minutes. |
| New Row Added | A row is added to the bottom of the selected worksheet. Google may delay the trigger by up to 3 minutes. |
| New Spreadsheet | A spreadsheet is created. |
| New Worksheet | A worksheet is created in the selected spreadsheet. |

## Prerequisites

* A Google account with access to the spreadsheets, worksheets, and Shared Drives used by your tools.
* A Google Cloud project with the Google Sheets API and Google Drive API enabled, and an OAuth client for Studio.

## Set up the integration

**1. Prepare Google OAuth credentials**

Create an OAuth client in Google Cloud and add the callback URL displayed in the Studio auth profile as an authorized redirect URI. Enable the Google Sheets API and Google Drive API for the Google Cloud project.

**2. Create the auth profile**

In **Integrations**, select **Google Sheets** > **Connect**. On **Project Auth Profiles**, select **New Profile** > **Integration Profile** > **Google Sheets** > **Continue**. Use **OAuth 2.0** and the **Preconfigured** usage mode. Studio prepopulates the authorization URL (`https://accounts.google.com/o/oauth2/v2/auth`), token and refresh URLs (`https://oauth2.googleapis.com/token`), and authorization parameters (`response_type=code`, `access_type=offline`, and `prompt=consent`). The requested scopes are `https://www.googleapis.com/auth/spreadsheets`, `https://www.googleapis.com/auth/drive.readonly`, and `https://www.googleapis.com/auth/drive`; PKCE is off by default. Enter the OAuth client ID and secret, copy the callback URL into the OAuth client configuration, and select **Create Profile**.

**3. Create the action tool**

In **Tools**, select **New Tool** > **Action** > **Google Sheets** > **Continue**. Select the **Action** and **Auth Profile**, configure the inputs, and choose whether to return the complete connector response or define custom output parameters. Select **Create Tool**, then [assign the tool to an agent](https://koreai.mintlify.site/agent-platform/tools/actions.md#assign-an-action-to-an-agent).

## Action reference

These fields match the Google Sheets action forms in Studio. Spreadsheet, worksheet, folder, and column dropdowns are populated from the selected auth profile and prior selections.

The optional `includeTeamDrives` boolean appears on every action except **Custom API Call**. It defaults to `false`; enable it to include spreadsheets and folders in Shared Drives in the dropdowns.

> [accordion] Add Row
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to update. |
> | `sheetId` | dropdown | Yes | Worksheet to update. |
> | `first_row_headers` | boolean | Yes | Whether the first row contains headers. Defaults to `false`. |
> | `as_string` | boolean | No | If enabled, dates and formulas are entered as strings and have no effect. No default is selected. |
> | `values` | object | Yes | Values to add to the row. |

> [accordion] Add Multiple Rows
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to update. |
> | `sheetId` | dropdown | Yes | Worksheet to update. |
> | `input_type` | enum | Yes | Input format: `CSV`, `JSON`, or `Column Names`. Defaults to `Column Names`. |
> | `values` | object | Yes | Values to add. |
> | `overwrite` | boolean | No | Replace existing sheet data with the input and clear any extra rows beyond the updated range. Defaults to `false`. |
> | `check_for_duplicate` | boolean | No | Check for duplicates before inserting; only unique rows are added based on the selected column. Defaults to `false`. |
> | `check_for_duplicate_column` | object | No | Column to check for duplicates. |
> | `as_string` | boolean | No | If enabled, dates and formulas are entered as strings and have no effect. No default is selected. |
> | `headerRow` | number | Yes | Row containing the column headers. Defaults to `1`. |

> [accordion] Update Row
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to update. |
> | `sheetId` | dropdown | Yes | Worksheet to update. |
> | `row_id` | number | Yes | Row number to update. |
> | `first_row_headers` | boolean | Yes | Whether the first row contains headers. Defaults to `false`. |
> | `values` | object | Yes | Values to write to the row. |

> [accordion] Update Multiple Rows
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to update. |
> | `sheetId` | dropdown | Yes | Worksheet to update. |
> | `values` | object | Yes | Values to update. |
> | `as_string` | boolean | No | If enabled, dates and formulas are entered as strings and have no effect. No default is selected. |
> | `headerRow` | number | Yes | Row containing the headers. |

> [accordion] Delete Row
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to update. |
> | `sheetId` | dropdown | Yes | Worksheet to update. |
> | `rowId` | number | Yes | Row number to delete. |

> [accordion] Find Rows
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to search. |
> | `sheetId` | dropdown | Yes | Worksheet to search. |
> | `columnName` | dropdown | Yes | Column to search. |
> | `searchValue` | string | No | Value to find. Leave blank to return all rows. |
> | `matchCase` | boolean | Yes | Return rows whose cell value exactly matches the search value. Defaults to `false`. |
> | `startingRow` | number | No | Row number where the search starts. |
> | `numberOfRows` | number | No | Number of rows to return. Defaults to `1` if omitted. |
> | `headerRow` | number | Yes | Row containing the column names. |
> | `useHeaderNames` | boolean | No | Use column names as result keys instead of `A`, `B`, `C`, and so on. Defaults to `false`. |

> [accordion] Create Spreadsheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `title` | string | Yes | Title of the new spreadsheet. |
> | `folder` | dropdown | No | Drive folder for the spreadsheet. If omitted, it is created in the root folder. |

> [accordion] Create Worksheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet where the worksheet will be created. |
> | `title` | string | Yes | Title of the new worksheet. |
> | `headers` | array | No | Column headers for the new worksheet. |

> [accordion] Clear Sheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to clear. |
> | `sheetId` | dropdown | Yes | Worksheet to clear. |
> | `is_first_row_headers` | boolean | Yes | Whether the first row contains headers. Defaults to `false`. |
> | `headerRow` | number | Yes | Row containing the headers, usually row `1`. |

> [accordion] Delete Worksheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet containing the worksheet. |
> | `sheetId` | dropdown | Yes | Worksheet to permanently delete. |

> [accordion] Rename Worksheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet containing the worksheet. |
> | `sheetId` | dropdown | Yes | Worksheet to rename. |
> | `newName` | string | Yes | New worksheet name. |

> [accordion] Format Row(s)
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to format. |
> | `sheetId` | dropdown | Yes | Worksheet to format. |
> | `startingRow` | number | Yes | First row to format. |
> | `endingRow` | number | No | Last row to format. Leave blank to format only `startingRow`. |
> | `bgColor` | string | No | Background color as a HEX code, such as `#FFD966`. |
> | `textColor` | string | No | Text color as a HEX code, such as `#FFD966`. |
> | `bold` | boolean | No | Apply bold formatting. |
> | `italic` | boolean | No | Apply italic formatting. |
> | `strikethrough` | boolean | No | Apply strikethrough formatting. |

> [accordion] Get Single Row by ID
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to read. |
> | `sheetId` | dropdown | Yes | Worksheet to read. |
> | `rowNumber` | number | Yes | Row number to retrieve. |
> | `headerRow` | number | Yes | Row containing the headers, usually row `1`. |

> [accordion] Get next row(s)
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to read. |
> | `sheetId` | dropdown | Yes | Worksheet to read. |
> | `startRow` | number | Yes | Row to start from. Defaults to `1`. |
> | `headerRow` | number | Yes | Row containing the headers. Defaults to `1`. |
> | `useHeaderNames` | boolean | No | Map column letters such as `A` and `B` to header names. Defaults to `false`. |
> | `markdown` | string | No | Optional note. The action remembers the last row using `memKey`; republishing keeps that value. Change `memKey` to start over. |
> | `memKey` | string | Yes | Key used to store the current row number. Defaults to `row_number`. |
> | `groupSize` | number | Yes | Number of rows to retrieve. Defaults to `1`. |

> [accordion] Get All Rows
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to read. |
> | `sheetId` | dropdown | Yes | Worksheet to read. |
> | `first_row_headers` | boolean | Yes | Whether the first row contains headers. Defaults to `false`. |

> [accordion] Find Spreadsheet(s)
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheet_name` | string | Yes | Name to search for. |
> | `exact_match` | boolean | No | If `true`, return exact name matches; if `false`, return names containing the search term. Defaults to `false`. |

> [accordion] Find Worksheet(s)
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to search. |
> | `title` | string | Yes | Worksheet title to search for. |
> | `exact_match` | boolean | No | If `true`, return exact title matches; if `false`, return titles containing the search term. Defaults to `false`. |

> [accordion] Copy Worksheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet containing the worksheet to copy. |
> | `sheetId` | dropdown | Yes | Worksheet to copy. |
> | `desinationSpeadsheetId` | dropdown | Yes | Destination spreadsheet. The parameter name is spelled this way in the connector schema. |

> [accordion] Create Spreadsheet Column
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to update. |
> | `sheetId` | dropdown | Yes | Worksheet to update. |
> | `columnName` | string | Yes | Name of the new column. |
> | `columnIndex` | number | No | Position starts at `1`. A value below `1` adds the column after the last existing column. |

> [accordion] Export Worksheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to export. |
> | `sheetId` | dropdown | Yes | Worksheet to export. |
> | `format` | enum | Yes | `Comma Separated Values (.csv)` (default) or `Tab Separated Values (.tsv)`. |
> | `returnAsText` | boolean | No | Return the export as text instead of a file. Defaults to `false`. |

> [accordion] Custom API Call
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `url` | object | Yes | Google Sheets API URL. |
> | `method` | enum | Yes | `GET`, `POST`, `PATCH`, `PUT`, `DELETE`, or `HEAD`. |
> | `headers` | object | Yes | Request headers. Studio injects authorization headers from the auth profile. |
> | `queryParams` | object | Yes | Query string parameters. |
> | `body_type` | enum | No | `None` (default), `JSON`, `Form Data`, or `Raw`. |
> | `body` | object | No | Request body. |
> | `response_is_binary` | boolean | No | Enable for file responses such as PDFs or images. Defaults to `false`. |
> | `failsafe` | boolean | No | **No Error on Failure** option. No default is selected. |
> | `timeout` | number | No | Request timeout in seconds. |
> | `followRedirects` | boolean | No | Follow redirects. Defaults to `false`. |

## Trigger reference

The optional `includeTeamDrives` trigger setting defaults to `false`. Turn it on to include Shared Drive spreadsheets in the **Spreadsheet** dropdowns. The spreadsheet and worksheet dropdowns update from the selected profile and prior selections.

> [accordion] New or Updated Row
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `info` | string (Markdown info) | No | Studio displays a note that Google may delay this trigger by up to 3 minutes. |
> | `includeTeamDrives` | boolean | No | Include Shared Drive spreadsheets. Defaults to `false`. |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to monitor. |
> | `sheetId` | dropdown | Yes | Worksheet to monitor. |
> | `trigger_column` | dropdown | No | Trigger only on changes to this column. Defaults to `Any Column` (`all_columns`). Choose a worksheet column to watch only that column. |

> [accordion] New Row Added
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `info` | string (Markdown info) | No | Studio displays a note that Google may delay this trigger by up to 3 minutes. |
> | `includeTeamDrives` | boolean | No | Include Shared Drive spreadsheets. Defaults to `false`. |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to monitor. |
> | `sheetId` | dropdown | Yes | Worksheet to monitor. |

> [accordion] New Spreadsheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `includeTeamDrives` | boolean | No | Include Shared Drive spreadsheets. Defaults to `false`. |

> [accordion] New Worksheet
>
> | Parameter | Type | Required | Description |
> | - | - | - | - |
> | `includeTeamDrives` | boolean | No | Include Shared Drive spreadsheets. Defaults to `false`. |
> | `spreadsheetId` | dropdown | Yes | Spreadsheet to monitor for new worksheets. |

## Troubleshoot common issues

| Issue | Resolution |
| - | - |
| OAuth authorization fails | Verify the OAuth client ID and secret, callback URL, enabled APIs, and requested scopes. |
| A spreadsheet or worksheet is missing from a dropdown | Confirm the authorized Google account can access it. Enable **Include Shared Drives** if the item is in a Shared Drive. |
| Rows are mapped to the wrong columns | Check whether the worksheet has headers and set `first_row_headers`, `is_first_row_headers`, and `headerRow` accordingly. |
| A row trigger is delayed | Google may take up to 3 minutes to notify Studio. Check the selected spreadsheet, worksheet, and `trigger_column`. |
| An export is returned as a file instead of text | Enable **Return as Text** (`returnAsText`). |
| A custom API request fails | Verify the Google Sheets API URL, HTTP method, query parameters, and request body. Studio injects authorization headers from the selected profile. |

## Related articles

* [Auth profiles](https://koreai.mintlify.site/agent-platform/administration/integrations-settings.md#auth-profiles)
* [Action Tools](https://koreai.mintlify.site/agent-platform/tools/actions.md)
* [Google Sheets API](https://developers.google.com/workspace/sheets/api)
* [Google Drive API](https://developers.google.com/workspace/drive/api)
* [Google OAuth 2.0](https://developers.google.com/identity/protocols/oauth2)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.