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

# Write Data

> Writes data to Google Sheets with multiple write modes including append, overwrite, and clear

Writes data to Google Sheets with multiple write modes including append, overwrite, and clear. Support multiple rows, can handle big datasets.

|                      |                     |
| -------------------- | ------------------- |
| **App**              | Google Sheets       |
| **Operation ID**     | `sheets_write_data` |
| **Type**             | Action              |
| **Connection**       | `drive` (optional)  |
| **Credits per run**  | 1                   |
| **Agent / MCP tool** | Yes                 |

## Inputs

| Field              | Type                                          | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------ | --------------------------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `spreadsheet`      | string                                        | Yes      | -       | Google Spreadsheet URL or ID, you must ask the user for it if not provided.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `sheet`            | string or SelectItem                          | Yes      | -       | The sheet to write data to. You can provide this in several ways: 1. If user provides just a sheet name, fill the object like this \{'label': 'Sheet1', 'value': 'Sheet1'} 2. If user provides only a sheet ID: Format as \{'label': '123456', 'value': '123456'} 3. If user provides dynamic values: Use the template syntax (e.g., '\{\{nodeId\_data\_sheet}}') 4. If user selects from dropdown: they will ge this format \{'label': 'Sheet1', 'value': '123456'}  If user doesn't provide sheet information, ask them to specify the sheet name or select from available sheets using the dropdown menu. |
| `write_mode`       | string or SelectableOption                    | Yes      | -       | Choose how to write the data to the sheet. Available options:  'append' - Add data to the end of the sheet after existing data, 'overwrite' - Replace data starting from a specific row, 'clear' - Remove all existing data before writing new data                                                                                                                                                                                                                                                                                                                                                          |
| `write_type`       | string or SelectableOption                    | Yes      | -       | Choose how to map your data into the sheet. Available options:  'all' - Write all data from previous steps to the sheet. Recommended for most cases, just provide data and everything is taken care of automatically. 'mapped' - Map data to specific columns manually.                                                                                                                                                                                                                                                                                                                                      |
| `starting_row`     | integer                                       | No       | `1`     | Enter the row number where data should start being written (e.g., 2), this is useful  when you want to write data below existing headers or data. Default is 1.                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `add_headers`      | boolean                                       | No       | `True`  | Write column headers at the top of the data. This uses the keys from your data objects as headers when data type is List of Objects,  and the first row of data when data type is List of Lists. Only applicable when write\_type is 'all'.                                                                                                                                                                                                                                                                                                                                                                  |
| `auto_format_data` | boolean                                       | No       | `True`  | Enable to render formulas and automatically allows Google Sheets to format numbers, dates, and percentages. Disable to write data as RAW text.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `data`             | array (also accepts a comma-separated string) | No       | -       | Select the data to write to the sheet. You can provide a list of objects, list of lists or any data type. Recommended to use a list of objects for best results so you can use headers. REQUIRED when write\_type is 'all'.  MUST BE NULL/EMPTY when write\_type is 'mapped' - clear this field if write\_type changes to 'mapped'. This field and column\_mapping are mutually exclusive - only one should be used at a time. For workflows, this will be mainly the output of an upstream node. Example: '\{\{nodeId\_\_data}}'                                                                            |
| `column_mapping`   | ColumnMapping                                 | No       | -       | Map source data fields to target columns. Column should be in the format of A, B, C, etc.  REQUIRED when write\_type is 'mapped'. MUST BE NULL/EMPTY when write\_type is 'all' - clear this field if write\_type changes to 'all'. This field and data are mutually exclusive - only one should be used at a time. For workflows, this will be mainly the output of an upstream node. Examples: \{'A': '\{\{nodeId\_\_data.cost}}', 'B': \['\{\{nodeId\_\_data.date}}']}                                                                                                                                     |

### ColumnMapping

Column mapping configuration where keys are column letters (A, B, C)

| Field  | Type   | Required | Default | Description |
| ------ | ------ | -------- | ------- | ----------- |
| `root` | object | Yes      | -       |             |

### SelectItem

| Field   | Type   | Required | Default | Description                                                                                          |
| ------- | ------ | -------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `value` | string | Yes      | -       | The value of the selectable item.                                                                    |
| `label` | string | Yes      | -       | The label of the selectable item, used for display purposes. If not provided, defaults to the value. |

### SelectableOption

| Field   | Type   | Required | Default | Description |
| ------- | ------ | -------- | ------- | ----------- |
| `value` | string | Yes      | -       |             |
| `label` | string | Yes      | -       |             |

## Output

**Type**: `str`

Returns success message with written range details.
