> For the complete documentation index, see [llms.txt](https://docs.planetcrust.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.planetcrust.com/human-connections/google/google-sheets-individual.md).

# Google Sheets

<p align="center"><a class="button primary" data-icon="circle-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>

<figure><img src="/files/auAzkjCWGFak171PMqGd" alt=""><figcaption></figcaption></figure>

<h3 align="center">Put Google Sheets to Work with @Human Automations and @Human Agents</h3>

<p align="center">The Google Sheets Connection documents all Triggers, Actions and Query Operations available for creating automations via the Google Sheets API.</p>

{% embed url="<https://www.youtube.com/watch?v=CyuUuaBSZzA>" %}

#### What can you do with the Google Sheets Connection?

* Connect to the Google Sheets API in a few clicks
* Use the related Google Sheets Operations (see below) in @Human Automations or @Human Agents

### Related Operations

#### Trigger Operations

**Spreadsheet Updated**

Triggers on: spreadsheets/spreadsheet.updated

Triggered when the spreadsheet is updated.

**Developer Metadata Changed**

Triggers on: spreadsheets-developer-metadata/developer\_metadata.changed

Triggered when developer metadata attached to the spreadsheet is changed.

**Sheet Created**

Triggers on: spreadsheets-sheets/sheet.created

Triggered when a new sheet is created in the spreadsheet.

**Values Updated**

Triggers on: spreadsheets-values/values.updated

Triggered when cell values in the spreadsheet are updated.

#### Action Operations

[Action: Change Sheet Properties](/human-connections/google/google-sheets-individual/action-change-sheet-properties.md)

[Action: Copy Range](/human-connections/google/google-sheets-individual/action-copy-range.md)

[Action: Copy Worksheet](/human-connections/google/google-sheets-individual/action-copy-worksheet.md)

[Action: Create Conditional Formatting Rule](/human-connections/google/google-sheets-individual/action-create-conditional-formatting-rule.md)

[Action: Create Multiple Spreadsheet Rows](/human-connections/google/google-sheets-individual/action-create-multiple-spreadsheet-rows.md)

[Action: Create Spreadsheet Column](/human-connections/google/google-sheets-individual/action-create-spreadsheet-column.md)

[Action: Create Spreadsheet Row at Top](/human-connections/google/google-sheets-individual/action-create-spreadsheet-row-at-top.md)

[Action: Create Spreadsheet Row](/human-connections/google/google-sheets-individual/action-create-spreadsheet-row.md)

#### Query Operations

Example link

### Related Automations

Example link

### Obtaining Access Credentials

> **Note:** @Human can access all Sheets the service account has access to. Share individual sheets or an entire Google Drive folder to control which Sheets are available.

**1. Create a Google Cloud project**

* Go to [Google Cloud Console](https://console.cloud.google.com/) and create a new project (or select an existing one).

**2. Enable required APIs**

* Navigate to **APIs & Services → Library**.
* Enable both the **Google Sheets API** and the **Google Drive API**.

**3. Create a Service Account**

* Under **Google Sheets API**, go to the **Credentials** tab and add a new **Service Account**.

**4. Download the JSON key**

* Open the newly created service account and go to the **Keys** tab.
* Click **Create new key**, select **JSON**, and click **Create**.

### Configuring Webhooks

**1. Enable Google Drive API**

* In the [**Google Cloud Console**](https://console.cloud.google.com/), navigate to **APIs & Services > Library**.
* Search for **"Google Drive API"** and click **Enable**.

**2. Verify Webhook Destination Domain**

* Go to **APIs & Services > Domain Verification**.
* Click **"Add domain"** and enter the top-level domain of your webhook URL.
* Complete the site ownership verification through **Google Search Console**.

**3. Configure Service Account Permissions**

* Open the **Google Sheet** you wish to monitor.
* Click **"Share"** and add the service account email.
* Assign at least **"Viewer"** permissions.

**4. Register the Webhook (Watch)**

* Send an authenticated `POST` request to the Google Drive API `watch` endpoint for the spreadsheet file.
* Specify the verified webhook URL and a unique channel ID in the request body.

**5. Renew Webhook Subscriptions**

* Monitor the expiration timestamp returned by the registration response (usually 7 days).
* Re-register the webhook channel before the expiration time to ensure continuous monitoring.

### Code (Apache v2.0): Service Connectivity and Metadata

```json
{
  "handle": "google-sheets-v4",
  "status": "active",
  "meta": {
    "short": "Google Sheets",
    "description": "Connect to Google Sheets to read and write data across all accessible spreadsheets.",
    "icon": "google-sheets",
    "tags": ["spreadsheet", "google", "data"]
  },
  "service": {
    "baseURL": {
      "value": "https://sheets.googleapis.com/v4/spreadsheets"
    },
    "protocol": "https",
    "contentType": "application/json",
    "auth": {
      "method": "oauth2_client_credentials",
      "params": {
        "oauth2ClientCredentials": {
          "value": "{{serviceAccountJSON}}",
          "placeholders": [
            {
              "name": "serviceAccountJSON",
              "type": "password",
              "description": "Google Service Account key JSON (downloaded from Google Cloud Console → IAM → Service Accounts → Keys).",
              "required": true,
              "default": ""
            }
          ]
        }
      }
    }
  }
}
```

> **Note on discovery**: At connection enable time the server uses the Drive API (`drive.readonly` scope) to list all spreadsheets the service account can see and injects them as dropdown options on the `spreadsheetId` and `sheetName` parameters of every registered operation. No `spreadsheetId` is stored in the connection config. To refresh the list after sharing new files, call `POST /api/system/configured-connections/{id}/refresh-discovery`.

### Code (Apache v2.0): List of External Resources and Internal Mapping

```
[
  {
    "handle": "spreadsheets",
    "meta": {
      "short": "Spreadsheets",
      "description": "Read and batch-update the spreadsheet scoped to this connection."
    },
    "endpoint": {
      "value": ""
    },
    "operations": {
      "read": {
        "method": "GET",
        "path": {
          "value": ""
        },
        "bodyTemplate": {
          "value": ""
        }
      },
      "update": {
        "method": "POST",
        "path": {
          "value": ":batchUpdate"
        },
        "headers": {
          "Content-Type": {
            "value": "application/json"
          }
        },
        "bodyTemplate": {
          "value": "{\"requests\": {{requests}}}",
          "placeholders": [
            {
              "name": "requests",
              "type": "String",
              "description": "JSON array of Request objects describing the updates to apply.",
              "required": true,
              "default": ""
            }
          ]
        }
      }
    },
    "fields": [
      {
        "name": "spreadsheetId",
        "type": "String",
        "selector": [
          "spreadsheetId"
        ],
        "meta": {
          "description": "The ID of the spreadsheet."
        }
      },
      {
        "name": "title",
        "type": "String",
        "selector": [
          "properties",
          "title"
        ],
        "meta": {
          "description": "The title of the spreadsheet."
        }
      },
      {
        "name": "locale",
        "type": "String",
        "selector": [
          "properties",
          "locale"
        ],
        "meta": {
          "description": "The locale of the spreadsheet (BCP 47 language tag)."
        }
      },
      {
        "name": "timeZone",
        "type": "String",
        "selector": [
          "properties",
          "timeZone"
        ],
        "meta": {
          "description": "The time zone of the spreadsheet (CLDR format)."
        }
      },
      {
        "name": "autoRecalc",
        "type": "String",
        "selector": [
          "properties",
          "autoRecalc"
        ],
        "meta": {
          "description": "The amount of time to wait before volatile functions are recalculated."
        }
      }
    ],
    "webhooks": [
      {
        "event": "spreadsheet.updated",
        "path": "/webhooks/google-sheets/spreadsheet/updated",
        "payload": [
          {
            "name": "spreadsheetId",
            "type": "String",
            "selector": [
              "spreadsheetId"
            ],
            "meta": {
              "description": "The unique ID of the spreadsheet."
            }
          },
          {
            "name": "title",
            "type": "String",
            "selector": [
              "properties",
              "title"
            ],
            "meta": {
              "description": "The title of the spreadsheet."
            }
          },
          {
            "name": "modifiedTime",
            "type": "String",
            "selector": [
              "modifiedTime"
            ],
            "meta": {
              "description": "The time the spreadsheet was last modified."
            }
          }
        ]
      },
      {
        "event": "spreadsheet.deleted",
        "path": "/webhooks/google-sheets/spreadsheet/deleted",
        "payload": [
          {
            "name": "spreadsheetId",
            "type": "String",
            "selector": [
              "spreadsheetId"
            ],
            "meta": {
              "description": "The ID of the deleted spreadsheet."
            }
          }
        ]
      }
    ]
  },
  {
    "handle": "spreadsheets-developer-metadata",
    "meta": {
      "short": "Developer Metadata",
      "description": "Read and search developer metadata attached to the spreadsheet."
    },
    "endpoint": {
      "value": "/developerMetadata"
    },
    "operations": {
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{metadataId}}",
          "placeholders": [
            {
              "name": "metadataId",
              "type": "Integer",
              "description": "The ID of the developer metadata entry to retrieve.",
              "required": true,
              "default": ""
            }
          ]
        },
        "bodyTemplate": {
          "value": ""
        }
      }
    },
    "fields": [
      {
        "name": "metadataId",
        "type": "Integer",
        "selector": [
          "metadataId"
        ],
        "meta": {
          "description": "The unique ID of the metadata entry."
        }
      },
      {
        "name": "metadataKey",
        "type": "String",
        "selector": [
          "metadataKey"
        ],
        "meta": {
          "description": "The metadata key."
        }
      },
      {
        "name": "metadataValue",
        "type": "String",
        "selector": [
          "metadataValue"
        ],
        "meta": {
          "description": "The metadata value."
        }
      },
      {
        "name": "visibility",
        "type": "String",
        "selector": [
          "visibility"
        ],
        "meta": {
          "description": "The metadata visibility (DOCUMENT or PROJECT)."
        }
      }
    ],
    "webhooks": [
      {
        "event": "developer_metadata.created",
        "path": "/webhooks/google-sheets/developer-metadata/created",
        "payload": [
          {
            "name": "metadataId",
            "type": "Integer",
            "selector": [
              "metadataId"
            ],
            "meta": {
              "description": "The unique ID of the metadata entry."
            }
          },
          {
            "name": "metadataKey",
            "type": "String",
            "selector": [
              "metadataKey"
            ],
            "meta": {
              "description": "The metadata key."
            }
          },
          {
            "name": "metadataValue",
            "type": "String",
            "selector": [
              "metadataValue"
            ],
            "meta": {
              "description": "The metadata value."
            }
          }
        ]
      },
      {
        "event": "developer_metadata.updated",
        "path": "/webhooks/google-sheets/developer-metadata/updated",
        "payload": [
          {
            "name": "metadataId",
            "type": "Integer",
            "selector": [
              "metadataId"
            ],
            "meta": {
              "description": "The unique ID of the metadata entry."
            }
          },
          {
            "name": "metadataKey",
            "type": "String",
            "selector": [
              "metadataKey"
            ],
            "meta": {
              "description": "The metadata key."
            }
          },
          {
            "name": "metadataValue",
            "type": "String",
            "selector": [
              "metadataValue"
            ],
            "meta": {
              "description": "The metadata value."
            }
          }
        ]
      },
      {
        "event": "developer_metadata.deleted",
        "path": "/webhooks/google-sheets/developer-metadata/deleted",
        "payload": [
          {
            "name": "metadataId",
            "type": "Integer",
            "selector": [
              "metadataId"
            ],
            "meta": {
              "description": "The ID of the deleted metadata entry."
            }
          }
        ]
      }
    ]
  },
  {
    "handle": "spreadsheets-sheets",
    "meta": {
      "short": "Sheets",
      "description": "Copy individual sheets within or across spreadsheets."
    },
    "endpoint": {
      "value": "/sheets"
    },
    "operations": {},
    "fields": [
      {
        "name": "sheetId",
        "type": "Integer",
        "selector": [
          "sheetId"
        ],
        "meta": {
          "description": "The ID of the sheet."
        }
      },
      {
        "name": "title",
        "type": "String",
        "selector": [
          "properties",
          "title"
        ],
        "meta": {
          "description": "The title (tab name) of the sheet."
        }
      },
      {
        "name": "index",
        "type": "Integer",
        "selector": [
          "properties",
          "index"
        ],
        "meta": {
          "description": "The zero-based index of the sheet within the spreadsheet."
        }
      },
      {
        "name": "sheetType",
        "type": "String",
        "selector": [
          "properties",
          "sheetType"
        ],
        "meta": {
          "description": "The type of the sheet (GRID, OBJECT, DATA_SOURCE)."
        }
      },
      {
        "name": "rowCount",
        "type": "Integer",
        "selector": [
          "properties",
          "gridProperties",
          "rowCount"
        ],
        "meta": {
          "description": "The number of rows in the grid."
        }
      },
      {
        "name": "columnCount",
        "type": "Integer",
        "selector": [
          "properties",
          "gridProperties",
          "columnCount"
        ],
        "meta": {
          "description": "The number of columns in the grid."
        }
      }
    ],
    "webhooks": [
      {
        "event": "sheet.created",
        "path": "/webhooks/google-sheets/sheet/created",
        "payload": [
          {
            "name": "sheetId",
            "type": "Integer",
            "selector": [
              "sheetId"
            ],
            "meta": {
              "description": "The ID of the new sheet."
            }
          },
          {
            "name": "title",
            "type": "String",
            "selector": [
              "properties",
              "title"
            ],
            "meta": {
              "description": "The title of the new sheet."
            }
          },
          {
            "name": "index",
            "type": "Integer",
            "selector": [
              "properties",
              "index"
            ],
            "meta": {
              "description": "The index of the sheet."
            }
          }
        ]
      },
      {
        "event": "sheet.updated",
        "path": "/webhooks/google-sheets/sheet/updated",
        "payload": [
          {
            "name": "sheetId",
            "type": "Integer",
            "selector": [
              "sheetId"
            ],
            "meta": {
              "description": "The ID of the updated sheet."
            }
          },
          {
            "name": "title",
            "type": "String",
            "selector": [
              "properties",
              "title"
            ],
            "meta": {
              "description": "The new title of the sheet."
            }
          },
          {
            "name": "index",
            "type": "Integer",
            "selector": [
              "properties",
              "index"
            ],
            "meta": {
              "description": "The new index of the sheet."
            }
          }
        ]
      },
      {
        "event": "sheet.deleted",
        "path": "/webhooks/google-sheets/sheet/deleted",
        "payload": [
          {
            "name": "sheetId",
            "type": "Integer",
            "selector": [
              "sheetId"
            ],
            "meta": {
              "description": "The ID of the deleted sheet."
            }
          }
        ]
      }
    ]
  },
  {
    "handle": "spreadsheets-values",
    "meta": {
      "short": "Values",
      "description": "Read and write cell values in the spreadsheet."
    },
    "endpoint": {
      "value": "/values"
    },
    "operations": {
      "read": {
        "method": "GET",
        "path": {
          "value": "/{{range}}",
          "placeholders": [
            {
              "name": "range",
              "type": "String",
              "description": "A1 notation of the range to retrieve (e.g. Sheet1!A1:D10).",
              "required": true,
              "default": ""
            }
          ]
        },
        "queryParams": {
          "majorDimension": {
            "value": "{{majorDimension}}"
          },
          "valueRenderOption": {
            "value": "{{valueRenderOption}}"
          }
        },
        "bodyTemplate": {
          "value": ""
        }
      },
      "create": {
        "method": "POST",
        "path": {
          "value": "/{{range}}:append",
          "placeholders": [
            {
              "name": "range",
              "type": "String",
              "description": "A1 notation of the range to search for a table to append to.",
              "required": true,
              "default": ""
            }
          ]
        },
        "headers": {
          "Content-Type": {
            "value": "application/json"
          }
        },
        "queryParams": {
          "valueInputOption": {
            "value": "RAW"
          }
        },
        "bodyTemplate": {
          "value": "{\"values\": {{values}}}",
          "placeholders": [
            {
              "name": "values",
              "type": "String",
              "description": "JSON 2D array of values to append.",
              "required": true,
              "default": ""
            }
          ]
        }
      },
      "update": {
        "method": "PUT",
        "path": {
          "value": "/{{range}}",
          "placeholders": [
            {
              "name": "range",
              "type": "String",
              "description": "A1 notation of the range to update.",
              "required": true,
              "default": ""
            }
          ]
        },
        "headers": {
          "Content-Type": {
            "value": "application/json"
          }
        },
        "queryParams": {
          "valueInputOption": {
            "value": "RAW"
          }
        },
        "bodyTemplate": {
          "value": "{\"values\": {{values}}}",
          "placeholders": [
            {
              "name": "values",
              "type": "String",
              "description": "JSON 2D array of values to write.",
              "required": true,
              "default": ""
            }
          ]
        }
      },
      "delete": {
        "method": "POST",
        "path": {
          "value": "/{{range}}:clear",
          "placeholders": [
            {
              "name": "range",
              "type": "String",
              "description": "A1 notation of the range to clear.",
              "required": true,
              "default": ""
            }
          ]
        },
        "bodyTemplate": {
          "value": ""
        }
      }
    },
    "fields": [
      {
        "name": "range",
        "type": "String",
        "selector": [
          "range"
        ],
        "meta": {
          "description": "The A1 notation of the range (e.g. Sheet1!A1:Z1000)."
        }
      },
      {
        "name": "majorDimension",
        "type": "String",
        "selector": [
          "majorDimension"
        ],
        "meta": {
          "description": "The major dimension of the values (ROWS or COLUMNS)."
        }
      },
      {
        "name": "values",
        "type": "String",
        "selector": [
          "values"
        ],
        "meta": {
          "description": "The cell values as a 2D array of strings."
        }
      }
    ],
    "webhooks": [
      {
        "event": "values.updated",
        "path": "/webhooks/google-sheets/values/updated",
        "payload": [
          {
            "name": "range",
            "type": "String",
            "selector": [
              "range"
            ],
            "meta": {
              "description": "The A1 range that was updated."
            }
          },
          {
            "name": "updatedRows",
            "type": "Integer",
            "selector": [
              "updatedRows"
            ],
            "meta": {
              "description": "The number of rows updated in the range."
            }
          },
          {
            "name": "updatedColumns",
            "type": "Integer",
            "selector": [
              "updatedColumns"
            ],
            "meta": {
              "description": "The number of columns updated in the range."
            }
          }
        ]
      },
      {
        "event": "values.appended",
        "path": "/webhooks/google-sheets/values/appended",
        "payload": [
          {
            "name": "range",
            "type": "String",
            "selector": [
              "range"
            ],
            "meta": {
              "description": "The A1 range where values were appended."
            }
          },
          {
            "name": "updatedRows",
            "type": "Integer",
            "selector": [
              "updatedRows"
            ],
            "meta": {
              "description": "The number of rows appended."
            }
          }
        ]
      },
      {
        "event": "values.cleared",
        "path": "/webhooks/google-sheets/values/cleared",
        "payload": [
          {
            "name": "range",
            "type": "String",
            "selector": [
              "range"
            ],
            "meta": {
              "description": "The A1 range that was cleared."
            }
          }
        ]
      }
    ]
  }
]
```

<p align="center"><a class="button primary" data-icon="square-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>


---

# 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://docs.planetcrust.com/human-connections/google/google-sheets-individual.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.
