# Google Sheet

Manipulate Google Sheets.

---

To target a specific sheet, select the desired Document and Sheet using the dropdown list, or enter their ID or name manually.

<img src="/img/workflow/google-sheet/node.png" alt="Google Sheet node with Document and Sheet dropdowns" style="max-width:158px;width:100%;display:inline;margin:0 auto;box-shadow:5px 5px 5px #eee" />

## Operations

The Google Sheet node supports operations on a single resource: **Sheet Within Document**.

### Sheet Within Document Operations

#### Get Rows
Retrieves data from a sheet in JSON format.
Column names are extracted from the header row and used as keys, and each subsequent row is converted into a JSON object where the cell values become the corresponding values.

For example, given the following sheet:

| fruit  | price |
|---------|-------|
| Apple   | 1.20  |
| Banana  | 0.80  |
| Orange  | 1.00  |

The output will be:

```json
[
  { "fruit": "Apple", "price": "1.20" },
  { "fruit": "Banana", "price": "0.80" },
  { "fruit": "Orange", "price": "1.00" }
]
```

You can configure the following options:

- **Data Location on Sheet** *(optional)*:
  - **Header Row**: Index of the row containing column names (defaults to `1`).
  - **First Data Row**: Index of the first row containing actual data (defaults to `2`).

#### Update Rows
Updates data in the sheet using the output from the previous node in the workflow.
The input must be a list of JSON objects where each object includes:
- A `"row_number"` field indicating the row to update.
- Keys that match the column names of the sheet, or specify a column by index using the syntax `col_<index>` (index starts at 1).

For example:

```json
[
  { "row_number": 3, "fruit": "Strawberry", "col_2": 1.20 },
  { "row_number": 4, "fruit": "Pineapple", "col_2": 2.50 }
]
```
In this example:
- Rows 3 and 4 will be updated.
- The cells under the “fruit” column, for rows 3 and 4, will be set to `Strawberry` and `Pineapple`, respectively.
- The cells under second column ("price", as per the above table), for rows 3 and 4, will be set to `1.20` and `2.50`, respectively.

You can configure the following options:

- **Data Location on Sheet** *(optional)*:
  - **Header Row**: Index of the row containing column names (defaults to `1`).
  - **First Data Row**: Index of the first row containing actual data (defaults to `2`).

> Notes:
> - Entries without a `"row_number"` field will be ignored.
> - Keys that don't match existing column names **will be ignored**, unless they use the `col_<index>` syntax to explicitly target a column by its position (starting at 1).
> - If a specified row number doesn't yet exist, the sheet will be extended to accommodate it.

#### Clear Rows
Clears a specified range of rows from the sheet.

You can configure the following option:

- **Range**: The cell range to clear.
  Example: `A3:C4`
