# Google Sheets

> Read and write rows in Google Sheets workbooks.

App · Spreadsheets · 18 actions · 1 trigger. Web page: https://docs.lodol.com/docs/integrations/google-sheets

## Triggers

Start a workflow when something happens in Google Sheets. See [how triggers work](https://docs.lodol.com/docs/concepts/triggers.md).

### Google Sheets New Row

Triggers when a new row is added to a Google Sheets spreadsheet.

**Filters**: Narrow which events start a run.

- `spreadsheet_id` (required)
- `sheet_name`

**Event fields**: What a run starts with. Later steps read each field with an @ reference.

- `fields` (object)
- `row_number` (number)
- `new_row_count` (number)

## Actions

### Append cell to column

Append a single value to the end of a column.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Column number (`column_index`, number, required): The column's position number: 1 for column A, 2 for column B, and so on.
- Value (`value`, text, required): The value to append
- How to save values (`value_input_option`, text): How Google Sheets reads the values written: as if typed (the default), or exactly as given. One of: `USER_ENTERED` (As if typed (numbers, dates, and formulas are recognized)), `RAW` (Exactly as given (text stays text)). Default: `USER_ENTERED`.

**Outputs**: No return value

### Append row

Append a single row to the end of a Google Sheet.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab to append the row to
- Row values (`row_values`, list, required): A list of values representing the row to append
- How to save values (`value_input_option`, text): How Google Sheets reads the values written: as if typed (the default), or exactly as given. One of: `USER_ENTERED` (As if typed (numbers, dates, and formulas are recognized)), `RAW` (Exactly as given (text stays text)). Default: `USER_ENTERED`.

**Outputs**: No return value

**Example output**

```json
{
  "status": "success"
}
```

### Clear row values

Clear values in a specific row without deleting the row itself.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Row number (`row_index`, number, required): The row number to clear. The first row is 1.

**Outputs**: No return value

### Clear tab

Clear all cells within a sheet/tab.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab to clear

**Outputs**: No return value

**Example output**

```json
{
  "status": "success"
}
```

### Create column

Insert a new column at a specified position.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Column number (`column_index`, number, required): The position where the new column will be inserted: 1 for column A, 2 for column B, and so on.

**Outputs**: No return value

### Create spreadsheet

Create a new Google Sheets spreadsheet.

**Inputs**

- Title (`title`, text, required): Title of the new spreadsheet
- Locale (`locale`, text): The spreadsheet's locale (language and region), for example en_US.
- Time zone (`time_zone`, text): Time zone of the spreadsheet (e.g., America/New_York)

**Outputs**

- `properties` (object): Spreadsheet properties
- `spreadsheet_id` (text): ID of the created spreadsheet
- `spreadsheet_url` (text): URL of the created spreadsheet

**Example output**

```json
{
  "properties": {
    "locale": "en_US",
    "title": "My Spreadsheet"
  },
  "spreadsheet_id": "1AbCdEfGhIjKlMnOpQrStUvWxYz",
  "spreadsheet_url": "https://docs.google.com/spreadsheets/d/1AbCdEfGhIjKlMnOpQrStUvWxYz/edit"
}
```

### Create tab

Create a new tab (sheet) within a spreadsheet.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): Name for the new tab
- Tab position (`sheet_index`, number): Where to place the new tab: 0 is the first position, 1 is the second, and so on.

**Outputs**: Response envelope; the payload is in the "result" field.

- `result` (object)
- `status` (text)

**Example output**

```json
{
  "result": {
    "index": 1,
    "sheet_id": 123456789,
    "title": "New Tab"
  },
  "status": "success"
}
```

### Delete column

Delete a single column from a sheet.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Column number (`column_index`, number, required): The position number of the column to delete: 1 for column A, 2 for column B, and so on.

**Outputs**: No return value

### Delete row

Delete a single row from a sheet.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Row number (`row_index`, number, required): The row number to delete. The first row is 1.

**Outputs**: No return value

### Delete spreadsheet

Delete a Google Sheets spreadsheet permanently.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet to delete

**Outputs**: No return value

### Delete tab

Delete a tab (sheet) from a spreadsheet by name.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): Name of the tab to delete

**Outputs**: No return value

**Example output**

```json
{
  "status": "success"
}
```

### Get column values

Return all values from a specific column, chosen by its position number.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Column number (`column_index`, number, required): The column's position number: 1 for column A, 2 for column B, and so on.

**Outputs**: Response envelope; the column values are in the 'values' field.

- `status` (text)
- `values` (list): List of values in the column

**Example output**

```json
{
  "status": "success",
  "values": [
    "Header",
    "Value1",
    "Value2",
    "Value3"
  ]
}
```

### Get row values

Return all values from a specific row as a list.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Row number (`row_index`, number, required): The row number to read. The first row is 1.

**Outputs**: Response envelope; the row values are in the 'values' field.

- `status` (text)
- `values` (list): List of values in the row

**Example output**

```json
{
  "status": "success",
  "values": [
    "Name",
    "Email",
    "Status",
    "Date"
  ]
}
```

### Read column

Read all values from a specific column.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Column (`column`, text, required): Column letter (e.g., 'A', 'B', 'AA')

**Outputs**: Response envelope; the column values are in the 'values' field.

- `status` (text)
- `values` (list): List of values in the column

**Example output**

```json
{
  "status": "success",
  "values": [
    "Header",
    "Value1",
    "Value2",
    "Value3"
  ]
}
```

### Read rows

Read every data row of a sheet at once. Each row comes back as an object keyed by the column headers (row.Email), plus the sheet row number (row.row_number), so Update row can write a result back to that exact row. Use this to loop over a list of records.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- First row is a header (`has_header`, true/false): Use the first row as the column names. Turn this off when the sheet starts straight into data; the columns are then named column_1, column_2, and so on. Default: `true`.
- Maximum rows (`max_rows`, number): Read at most this many data rows. Leave empty to read them all.

**Outputs**: Response envelope; the rows are in the 'rows' field. Read a value off a row by its column name (row.Email), never by position.

- `count` (number): How many data rows were read
- `headers` (list): The column names, in sheet order
- `rows` (list): One object per data row, keyed by column header, plus 'row_number' (the row's position in the sheet, for writing a result back to it)
- `status` (text)

**Example output**

```json
{
  "count": 2,
  "headers": [
    "Company",
    "Contact Name",
    "Email",
    "Status"
  ],
  "rows": [
    {
      "Company": "Acme Corp",
      "Contact Name": "Jordan Lee",
      "Email": "jordan@acme.test",
      "Status": "New",
      "row_number": 2
    },
    {
      "Company": "Northwind",
      "Contact Name": "Sam Rivera",
      "Email": "sam@northwind.test",
      "Status": "",
      "row_number": 3
    }
  ],
  "status": "success"
}
```

### Rename tab

Rename an existing tab in a spreadsheet.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): Current name of the tab
- New sheet name (`new_sheet_name`, text, required): New name for the tab

**Outputs**: Response envelope; the payload is in the "result" field.

- `result` (object)
- `status` (text)

**Example output**

```json
{
  "result": {
    "sheet_id": 123456789,
    "title": "Renamed Tab"
  },
  "status": "success"
}
```

### Update row

Set some cells of one row by column name, leaving the rest of the row as it is. Pair it with Read rows to write a result back to the row it came from (row.row_number). A column that doesn't exist yet is added to the header row.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Row number (`row_index`, number, required): The row to update. Row 1 holds the column names, so the first data row is 2. Read rows gives each row's number as row_number.
- Values (`values`, object, required): The cells to set, by column name, e.g. {"Category": "Travel"}. Columns left out keep their values; an empty value clears the cell.
- How to save values (`value_input_option`, text): How Google Sheets reads the values written: as if typed (the default), or exactly as given. One of: `USER_ENTERED` (As if typed (numbers, dates, and formulas are recognized)), `RAW` (Exactly as given (text stays text)). Default: `USER_ENTERED`.

**Outputs**: No return value

**Example output**

```json
{
  "added_columns": [],
  "status": "success"
}
```

### Write row

Overwrite a whole row, from column A, with values in column order. To change only some cells of a row, use Update row.

**Inputs**

- Spreadsheet URL (`spreadsheet_url`, text, required): The URL of the spreadsheet
- Sheet name (`sheet_name`, text, required): The name of the sheet/tab
- Row number (`row_index`, number, required): The row number to write to. The first row is 1.
- Row values (`row_values`, list, required): A list of values to write into the row
- How to save values (`value_input_option`, text): How Google Sheets reads the values written: as if typed (the default), or exactly as given. One of: `USER_ENTERED` (As if typed (numbers, dates, and formulas are recognized)), `RAW` (Exactly as given (text stays text)). Default: `USER_ENTERED`.

**Outputs**: No return value

**Example output**

```json
{
  "status": "success"
}
```
