> 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/sheets.md).

# Google Sheets

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

## Overview

Google Sheets is a powerful cloud-based spreadsheet application with real-time collaboration capabilities. This integration enables automated data entry, spreadsheet management, and collaborative workflow automation. Streamline data analysis and enhance team productivity through automated spreadsheet operations.

## Setup

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

* **Google Sheets**

### 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 Sheets** 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 Sheets while keeping your credentials secure.

## Actions

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

### 1. Add some content to a table

Append content to a Google Sheets table.

### 2. Clear the worksheet range

Clear the contents of a worksheet range.

### 3. Copy the sheet with a name

Copy a sheet within a Google Sheets file, giving the copy a name.

### 4. Create a new sheet in the file

Create a new sheet in a Google Sheets file.

### 5. Create a table in a sheet

Create a table in a spreadsheet's sheet.

### 6. Create a worksheet range in a sheet

Create a reference to a range of cells in a sheet.

### 7. Create a google spreadsheet in a folder

Create a new Google Sheets spreadsheet.

### 8. Delete the sheet

Delete a sheet from a Google Sheets file.

### 9. Get the cell's color

Get the background (fill) color of a cell as a hex string.

### 10. Get the cell's formula

Get the formula of a cell.

### 11. Get the cell's number format

Get the number format pattern of a cell.

### 12. Get the cell's value

Get the value of a cell.

### 13. Get the column count in a worksheet range

Get the number of columns in a worksheet range.

### 14. Get the file's sheets

Get the sheets from a Google Sheets file.

### 15. Get the following row range in a worksheet range

Get the range covering the single row immediately below a worksheet range.

### 16. Get the row count in a worksheet range

Get the number of rows in a worksheet range.

### 17. Get the row's cells from the worksheet range

Get the cells of a row within a worksheet range.

### 18. Get the sheet's tables

Get the tables from a Google Sheets sheet.

### 19. Get the sheet's used range

Get the range of cells that contain data in a sheet.

### 20. Get the worksheet range's rows

Get the rows from a worksheet range.

### 21. Insert a new column in the table

Create a new column in a Google Sheets table.

### 22. Insert a new row in the table

Create a new row in a Google Sheets table.

### 23. Read the content from a table

Get the contents of a Google Sheets table.

### 24. Read the content from a worksheet range

Get the contents of a worksheet range.

### 25. Rename the sheet to a new name

Rename a sheet in a Google Sheets file.

### 26. Retrieve the columns from the table

Get the columns from a Google Sheets table.

### 27. Retrieve the rows from the table

Get the rows from a Google Sheets table.

### 28. Set the cell's color to a color

Set the background (fill) color of a cell.

### 29. Set the cell's content to a value

Set the value of a cell.

### 30. Set the cell's font color to a color

Set the font (text) color of a cell.

### 31. Set the cell's formula to a formula value

Set the formula of a cell.

### 32. Set the cell's number format to a format string

Set the number format of a cell.

### 33. Set the range's color to a color

Set the background (fill) color of every cell in a worksheet range.

### 34. Set the range's font color to a color

Set the font (text) color of every cell in a worksheet range.

### 35. Set the worksheet range's number format to a format string

Set the number format of every cell in a worksheet range.

### 36. Write the content in a table

Update the contents of a Google Sheets table.

### 37. Write the content in a worksheet range

Write content into a worksheet range starting at the range's top-left cell.

## Concepts

### Google sheet table reference

Reference to a table inside a Google Sheets spreadsheet's sheet.

| Field Name        | Description                | Type   |
| ----------------- | -------------------------- | ------ |
| `id`              | Id of the table            | `text` |
| `name`            | Name of the table          | `text` |
| `sheet_reference` | Sheet the table belongs to | `json` |

### Google sheet reference

Reference to a sheet inside a Google Sheets spreadsheet file.

| Field Name | Description                           | Type     |
| ---------- | ------------------------------------- | -------- |
| `id`       | Id of the sheet                       | `number` |
| `name`     | Name of the sheet                     | `text`   |
| `file`     | spreadsheet file the sheet belongs to | `json`   |

### Google sheet range reference

Reference to a range of cells inside a Google Sheets spreadsheet's sheet.

| Field Name           | Description                                                      | Type               |
| -------------------- | ---------------------------------------------------------------- | ------------------ |
| `file`               | spreadsheet file the range belongs to                            | `json`             |
| `sheet_id`           | Id of the sheet the range belongs to                             | `number`           |
| `sheet_name`         | Name of the sheet the range belongs to                           | `text`             |
| `address`            | A1 notation of the range without the sheet prefix (e.g. "A1:B2") | `text`             |
| `start_row_index`    | 0-based index of the first row in the range                      | `optional[number]` |
| `end_row_index`      | 0-based exclusive index of the last row in the range             | `optional[number]` |
| `start_column_index` | 0-based index of the first column in the range                   | `optional[number]` |
| `end_column_index`   | 0-based exclusive index of the last column in the range          | `optional[number]` |
| `row_count`          | Number of rows in the range                                      | `optional[number]` |
| `column_count`       | Number of columns in the range                                   | `optional[number]` |
| `cell_count`         | Number of cells in the range                                     | `optional[number]` |

### 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 sheet column reference

Reference to a column inside a Google Sheets spreadsheet's sheet.

| Field Name | Description                 | Type     |
| ---------- | --------------------------- | -------- |
| `index`    | Index of the column         | `number` |
| `name`     | Name of the column          | `text`   |
| `table`    | Table the column belongs to | `json`   |

### Google sheet row reference

Reference to a row inside a Google Sheets spreadsheet's sheet.A row can belong either to a table (`table` is set) or to a worksheet range (`range_reference` is set).

| Field Name                                         | Description                                            | Type                                     |
| -------------------------------------------------- | ------------------------------------------------------ | ---------------------------------------- |
| `index`                                            | Index of the row                                       | `number`                                 |
| [`values`](#list-of-any)                           | Values in that row                                     | `list of list of any`                    |
| [`table`](#google-sheet-table-reference)           | Table the row belongs to, if the row came from a table | `optional[google sheet table reference]` |
| [`range_reference`](#google-sheet-range-reference) | Range the row belongs to, if the row came from a range | `optional[google sheet range reference]` |

### Google sheet cell reference

Reference to a single cell inside a Google Sheets spreadsheet's sheet.A cell is a 1x1 range; `row_index` and `column_index` are 0-based (A1 -> row 0, column 0).

| Field Name     | Description                                                                                                            | Type             |
| -------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------- |
| `file`         | spreadsheet file the cell belongs to                                                                                   | `json`           |
| `sheet_id`     | Id of the sheet the cell belongs to                                                                                    | `number`         |
| `sheet_name`   | Name of the sheet the cell belongs to                                                                                  | `text`           |
| `row_index`    | 0-based row index of the cell                                                                                          | `number`         |
| `column_index` | 0-based column index of the cell                                                                                       | `number`         |
| `address`      | A1 notation of the cell without the sheet prefix (e.g. "B3"). Derived from row\_index/column\_index when not provided. | `optional[text]` |
| `table_id`     | Id of the table the cell belongs to, when applicable                                                                   | `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/sheets.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.
