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

# Google Sheets: Spreadsheet Access for AI Agents

> Read and write spreadsheet data through the Google Sheets API. Extract data, generate reports, or update tracking sheets.

## Overview

OneCLI connects AI agents to Google Sheets through Google's OAuth flow. Agents can read spreadsheet data, write values, create new sheets, and manage formatting. The gateway injects OAuth credentials into requests to the Google Sheets API automatically.

This is useful for agents that need to extract data from spreadsheets, generate reports, populate templates, or sync data between systems.

## Setup

<Steps>
  <Step title="Go to Connections">
    Open the OneCLI dashboard and navigate to **Connections** > **Google Sheets**.
  </Step>

  <Step title="Authorize">
    Click **Connect Google Sheets**. You'll be redirected to Google to authorize OneCLI. Review the permissions and click **Allow**.
  </Step>
</Steps>

## What agents can do

* Read cell values from specific ranges (e.g., `Sheet1!A1:D10`)
* Write values to individual cells or ranges
* Append rows to the bottom of a sheet
* Create new spreadsheets with specified titles and initial data
* Add, rename, and delete sheets within a spreadsheet
* Read and apply cell formatting (bold, colors, borders, number formats)
* Create and manage named ranges
* Read spreadsheet metadata (title, sheets, locale)
* Clear cell contents in a specified range
* Batch read or write multiple ranges in a single request

## Controlling access with rules

Use OneCLI's [rules engine](/guides/rules) to limit what agents can do with your spreadsheets. For example, you can allow read-only access for data extraction agents, or restrict write operations to specific spreadsheet IDs. Rules are evaluated before credential injection, so a blocked request never reaches Google Sheets.
