---
related_nodes: ["google_drive", "google_docs"]
---

# Google Sheets

Create, read and edit Google spreadsheets from workflows.

## When to Use

- Reading a range of figures to process or summarize
- Writing results into a report sheet
- Appending a row per event, form submission or order
- Clearing a range before a fresh export
- Adding, renaming and removing tabs
- Any other edit Google Sheets supports (formatting, sorting, merges, charts) through batch update

## How It Works

The Google Sheets node calls the Google Sheets API with one operation per node. The same operations are the `google_sheets` agent tool group (`sheets_<op>` tools) and `verdalia.api.sheets` in JavaScript nodes.

Before using this node, add a Google OAuth connection in **Settings → Connections**. Sheets uses the `drive` scope; a call on a connection that lacks it fails with an error asking to reconnect the account.

## Configuration

**connection** - Google connection to use
- Agents should call `list_connections` and set `connection` to the returned `id` ULID
- Must be a "google" connection type
- Required; a node saved without one stores `null` and fails validation with "Connection is required"

**operation** - Operation to perform, chosen by `op`:
- `create`: Create a spreadsheet
- `get`: Get a spreadsheet's structure (tabs, named ranges), without cell values
- `read_range`: Read the cells of one A1 range
- `write_range`: Overwrite the cells of one A1 range
- `append_rows`: Append rows after a table
- `clear_range`: Clear the values of one A1 range
- `add_tab`: Add a tab
- `rename_tab`: Rename a tab
- `delete_tab`: Delete a tab with its cells
- `batch_update`: Apply Google Sheets batchUpdate requests
- `delete`: Move the spreadsheet to Drive's trash (restorable)

Every text field is interpolatable from input. Missing required values fail when the node runs.

**spreadsheet_id** (every operation but `create`) - The ID in the spreadsheet's URL, `https://docs.google.com/spreadsheets/d/<id>/edit`, or the `spreadsheetId` a create returns.

**range** - A1 notation: `Q3!A1:F40`, `Sheet1!A:F`, or a tab title alone for the whole tab. Quote tab titles with spaces: `'Q3 Numbers'!A1:F40`.

**sheet_id** - A tab's numeric ID (`sheetId`), from `get`, `create` or `add_tab`. Not the tab title.

### Operation: create

**title** - Spreadsheet title. The spreadsheet is created in the root of the connection's Drive with one empty tab.

### Operation: read_range

**value_render** - How cells are rendered
- `FORMATTED_VALUE` (default): as the sheet displays them
- `UNFORMATTED_VALUE`: the underlying numbers and booleans
- `FORMULA`: formulas instead of their results

### Operation: write_range and append_rows

**values** (`write_range`) / **rows** (`append_rows`) - A JSON array of rows, each an array of cells. A cell is text, a number or a boolean; a formula is text starting with `=`.
- Example: `[["Region", "Revenue"], ["North", 1200], ["South", "=B2*2"]]`
- A single reference such as `{{ input.rows }}` passes an array from a previous node

**value_input** - How Google reads the values
- `USER_ENTERED` (default): as if typed into the sheet; formulas, numbers and dates are parsed
- `RAW`: stored exactly as given

`write_range` starts at the range's top-left cell. `append_rows` finds the table in the range and inserts the rows below its last row.

### Operation: add_tab, rename_tab, delete_tab

**title** - The tab's title (`add_tab`, `rename_tab`). Must differ from every other tab's.

A spreadsheet keeps at least one tab; deleting the last one fails.

### Operation: batch_update

**requests** - A JSON array of Google Sheets `Request` objects, applied in order and atomically. See Google's `spreadsheets.batchUpdate` reference.
- Example: `[{"repeatCell": {"range": {"sheetId": 0, "startRowIndex": 0, "endRowIndex": 1}, "cell": {"userEnteredFormat": {"textFormat": {"bold": true}}}, "fields": "userEnteredFormat.textFormat.bold"}}]`

### Retry

**retry** - Whether each Sheets request is sent again after a failure that passes: a rate limit, a busy server, a dropped connection. Off by default; see [Retries](http_get.md#retries) for how attempts and waits work. `get` and `read_range` are reads, sent again freely, as is `write_range`, which writes the same values again. `create`, `append_rows`, `clear_range`, the tab edits, `batch_update` and `delete` are writes, sent again only when Google refused them before acting: the connection never opened, or Google answered 425 or 429. The `google_sheets` tool group takes the same setting.

## Inputs

**input** - Any input
- Triggers the node and supplies data for interpolation
- Required

## Outputs

**output** - The operation's result

For `create`:
```json
{
  "spreadsheetId": "1AbC...xyz",
  "properties": {"title": "Q3 Report"},
  "spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1AbC...xyz/edit",
  "sheets": [{"properties": {"sheetId": 0, "title": "Sheet1", "index": 0}}]
}
```

For `get`: Google's spreadsheet resource (`spreadsheetId`, `properties`, `sheets` with each tab's `properties` and `gridProperties`, `namedRanges`, `spreadsheetUrl`).

For `read_range`:
```json
{
  "range": "Q3!A1:B3",
  "values": [["Region", "Revenue"], ["North", "1,200"], ["South", "2,400"]]
}
```
Trailing empty cells are left out, so rows can differ in length; `values` is absent for an empty range.

For `write_range`:
```json
{"updatedRange": "Sheet1!A1:B3", "updatedRows": 3, "updatedColumns": 2, "updatedCells": 6}
```

For `append_rows`:
```json
{
  "tableRange": "Sheet1!A1:B10",
  "updates": {"updatedRange": "Sheet1!A11:B11", "updatedRows": 1, "updatedColumns": 2, "updatedCells": 2}
}
```

For `clear_range`: `{"clearedRange": "Sheet1!A2:F100"}`

For `add_tab`: the new tab's `{"sheetId": 123456, "title": "Q4", "index": 3}`

For `rename_tab` and `delete_tab`: `{"spreadsheetId": "1AbC...xyz"}`

For `batch_update`: Google's response, with one entry in `replies` per request.

For `delete`: the trashed file's Drive metadata.

## Example

Append a row per order:

```json
{
  "google_sheets": {
    "connection": "01J...",
    "operation": {
      "op": "append_rows",
      "spreadsheet_id": "1AbC...xyz",
      "range": "Orders!A:D",
      "rows": "{{ input.rows }}",
      "value_input": "USER_ENTERED"
    }
  }
}
```

Here a previous node (for example a JavaScript node) emits `rows` as an array such as `[["A-1001", "Ada", 42.5, "2026-11-05"]]`. Building the JSON with a single reference keeps a quote or comma inside a value from breaking it.

## Agent Tools

Agents reach the same operations through the `google_sheets` tool group, requested with `request_tool` and configured with a Google connection. Each switch in the group (`create`, `get`, `read_range`, `write_range`, `append_rows`, `clear_range`, `add_tab`, `rename_tab`, `delete_tab`, `batch_update`, `delete`) emits one tool, all on by default. Tool names carry the connection's handle, such as `google_freja__sheets_read_range`.

| Tool | Does | Risk |
|------|------|------|
| `sheets_create` | Create a spreadsheet | Write |
| `sheets_get` | Read a spreadsheet's outline | Read |
| `sheets_read_range` | Read one A1 range | Read |
| `sheets_write_range` | Overwrite one A1 range | Write |
| `sheets_append_rows` | Append rows after a table | Write |
| `sheets_clear_range` | Clear one A1 range | Write |
| `sheets_add_tab` | Add a tab | Write |
| `sheets_rename_tab` | Rename a tab | Write |
| `sheets_delete_tab` | Delete a tab | Write |
| `sheets_batch_update` | Apply batchUpdate requests | Write |
| `sheets_delete` | Move the spreadsheet to Drive's trash | Delete |

The tools take the same fields as the node's operations, with `values` and `rows` as JSON arrays and `sheet_id` as a number, and return the same results, except `sheets_get`. It returns a bounded outline rather than the whole resource:

```json
{
  "spreadsheetId": "1AbC...xyz",
  "title": "Q3 Report",
  "spreadsheetUrl": "https://docs.google.com/spreadsheets/d/1AbC...xyz/edit",
  "tabCount": 2,
  "tabs": [
    {"sheetId": 0, "title": "Q3", "index": 0, "rowCount": 1000, "columnCount": 26},
    {"sheetId": 1834, "title": "Notes", "index": 1, "rowCount": 1000, "columnCount": 26}
  ]
}
```

Titles are cut to 200 bytes (at a character boundary) and at most 100 tabs are listed; `tabCount` counts them all. The node's `get` and `verdalia.api.sheets` return the whole resource.

## Runtime Errors

| Error | Cause | Remediation |
|-------|-------|-------------|
| Connection not selected or unavailable | `connection` is empty or not a usable Google connection | Use `list_connections`, then set `connection` to the returned `id` ULID |
| Does not have Google Sheets access | The connection lacks the `drive` scope | Reconnect the Google account and allow Drive access |
| A spreadsheet id is required | `spreadsheet_id` is blank (a tool or script call; the node reports the empty field itself) | Pass the ID from the spreadsheet URL or a create |
| Could not find the requested item | Wrong `spreadsheet_id`, or the account cannot see the file | Use the ID from the spreadsheet URL; check sharing |
| Unable to parse range | `range` is not valid A1 notation or names a missing tab | Check the tab title and quote titles with spaces |
| must be a JSON array of rows | `values` or `rows` is not an array of arrays | Pass `[[...], [...]]`, one inner array per row |
| sheet_id is not usable | `sheet_id` is not a number | Use the numeric `sheetId` from `get`, not the tab title |

## Tips

- Use `get` to find tab IDs and titles, then `read_range` for the values
- `USER_ENTERED` turns `"=SUM(B2:B10)"` into a formula and `"2024-03-15"` into a date; use `RAW` to keep text as text
- `clear_range` keeps formatting; use `batch_update` with `updateCells` or `deleteDimension` to remove formatting or rows
- `delete` moves the spreadsheet to Drive's trash; restore it from Drive within 30 days
