> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/google_sheets.md).

# google\_sheets

[Google Sheets](https://sheets.google.com/) is a powerful cloud-based spreadsheet application that allows users to create, edit, and collaborate on spreadsheets in real-time. As part of Google's productivity suite, Google Sheets offers a versatile platform for data organization, analysis, and visualization with robust formatting, formula, and sharing capabilities.

With Google Sheets, you can:

* **Create and edit spreadsheets**: Develop data-driven documents with comprehensive formatting and calculation options
* **Collaborate in real-time**: Work simultaneously with multiple users on the same spreadsheet
* **Analyze data**: Use formulas, functions, and pivot tables to process and understand your data
* **Visualize information**: Create charts, graphs, and conditional formatting to represent data visually
* **Access anywhere**: Use Google Sheets across devices with automatic cloud synchronization
* **Work offline**: Continue working without internet connection with changes syncing back online
* **Integrate with other services**: Connect with Google Drive, Forms, and third-party applications

In Agent Forge, the Google Sheets integration enables your agents to interact directly with spreadsheet data programmatically. This allows for powerful automation scenarios such as data extraction, analysis, reporting, and management. Your agents can read existing spreadsheets to extract information, write to spreadsheets to update data, and create new spreadsheets from scratch. This integration bridges the gap between your AI workflows and data management, enabling seamless interaction with structured data. By connecting Agent Forge with Google Sheets, you can automate data workflows, generate reports, extract insights from data, and maintain up-to-date information — all through your intelligent agents. The integration supports various data formats and range specifications, making it flexible enough to handle diverse data management needs while maintaining the collaborative and accessible nature of Google Sheets.

## Usage Instructions

Integrate Google Sheets functionality to manage spreadsheet data. Read data from specific ranges, write new data, update existing cells, and append data to the end of sheets using OAuth authentication. Supports various input and output formats for flexible data handling.

## Tools

### `google_sheets_read`

Read data from a Google Sheets spreadsheet

#### Input

| Parameter       | Type   | Required | Description                                |
| --------------- | ------ | -------- | ------------------------------------------ |
| `accessToken`   | string | Yes      | The access token for the Google Sheets API |
| `spreadsheetId` | string | Yes      | The ID of the spreadsheet to read from     |
| `range`         | string | No       | The range of cells to read from            |

#### Output

| Parameter        | Type   | Description           |
| ---------------- | ------ | --------------------- |
| `data`           | json   | Sheet data            |
| `metadata`       | json   | Operation metadata    |
| `updatedRange`   | string | Updated range         |
| `updatedRows`    | number | Updated rows count    |
| `updatedColumns` | number | Updated columns count |
| `updatedCells`   | number | Updated cells count   |
| `tableRange`     | string | Table range           |

### `google_sheets_write`

Write data to a Google Sheets spreadsheet

#### Input

| Parameter                 | Type    | Required | Description                                           |
| ------------------------- | ------- | -------- | ----------------------------------------------------- |
| `accessToken`             | string  | Yes      | The access token for the Google Sheets API            |
| `spreadsheetId`           | string  | Yes      | The ID of the spreadsheet to write to                 |
| `range`                   | string  | No       | The range of cells to write to                        |
| `values`                  | array   | Yes      | The data to write to the spreadsheet                  |
| `valueInputOption`        | string  | No       | The format of the data to write                       |
| `includeValuesInResponse` | boolean | No       | Whether to include the written values in the response |

#### Output

| Parameter        | Type   | Description           |
| ---------------- | ------ | --------------------- |
| `data`           | json   | Sheet data            |
| `metadata`       | json   | Operation metadata    |
| `updatedRange`   | string | Updated range         |
| `updatedRows`    | number | Updated rows count    |
| `updatedColumns` | number | Updated columns count |
| `updatedCells`   | number | Updated cells count   |
| `tableRange`     | string | Table range           |

### `google_sheets_update`

Update data in a Google Sheets spreadsheet

#### Input

| Parameter                 | Type    | Required | Description                                           |
| ------------------------- | ------- | -------- | ----------------------------------------------------- |
| `accessToken`             | string  | Yes      | The access token for the Google Sheets API            |
| `spreadsheetId`           | string  | Yes      | The ID of the spreadsheet to update                   |
| `range`                   | string  | No       | The range of cells to update                          |
| `values`                  | array   | Yes      | The data to update in the spreadsheet                 |
| `valueInputOption`        | string  | No       | The format of the data to update                      |
| `includeValuesInResponse` | boolean | No       | Whether to include the updated values in the response |

#### Output

| Parameter        | Type   | Description           |
| ---------------- | ------ | --------------------- |
| `data`           | json   | Sheet data            |
| `metadata`       | json   | Operation metadata    |
| `updatedRange`   | string | Updated range         |
| `updatedRows`    | number | Updated rows count    |
| `updatedColumns` | number | Updated columns count |
| `updatedCells`   | number | Updated cells count   |
| `tableRange`     | string | Table range           |

### `google_sheets_append`

Append data to the end of a Google Sheets spreadsheet

#### Input

| Parameter                 | Type    | Required | Description                                            |
| ------------------------- | ------- | -------- | ------------------------------------------------------ |
| `accessToken`             | string  | Yes      | The access token for the Google Sheets API             |
| `spreadsheetId`           | string  | Yes      | The ID of the spreadsheet to append to                 |
| `range`                   | string  | No       | The range of cells to append after                     |
| `values`                  | array   | Yes      | The data to append to the spreadsheet                  |
| `valueInputOption`        | string  | No       | The format of the data to append                       |
| `insertDataOption`        | string  | No       | How to insert the data (`OVERWRITE` or `INSERT_ROWS`)  |
| `includeValuesInResponse` | boolean | No       | Whether to include the appended values in the response |

#### Output

| Parameter        | Type   | Description           |
| ---------------- | ------ | --------------------- |
| `data`           | json   | Sheet data            |
| `metadata`       | json   | Operation metadata    |
| `updatedRange`   | string | Updated range         |
| `updatedRows`    | number | Updated rows count    |
| `updatedColumns` | number | Updated columns count |
| `updatedCells`   | number | Updated cells count   |
| `tableRange`     | string | Table range           |

## Notes

* Category: `tools`
* Type: `google_sheets`


---

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

```
GET https://whitepaper.aitech.io/agentforge/tools/google_sheets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
