L2 Construct: set_cell
sheets googleDescription
SetCell sets the value of a specific cell in a Google Sheets spreadsheet.
This handler takes the following input:
- spreadsheet_id: The ID of the Google Sheets spreadsheet
- sheet_name: The name of the sheet within the spreadsheet
- location: An object specifying the row and column of the cell to set
- value: An object containing the value to set and its type
It returns:
- spreadsheet_id: The ID of the spreadsheet (same as input)
- sheet_name: The name of the sheet (same as input)
- spreadsheet_url: The URL to access the spreadsheet
- location: The location of the cell that was set (same as input)
This function allows you to update a single cell in a Google Sheets spreadsheet with a new value.
L2 Data
- Provider: google
- Module: gsheets
- Action: set_cell
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "google",
"module": "gsheets",
"action": "set_cell",
"metadata": {}
}
}
Input
Example
{
"spreadsheet_id": "1234567890",
"sheet_name": "Sheet1",
"location": {
"row": 0,
"col": 0
},
"set_value": {
"value": null,
"value_type": ""
}
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gsheets/set-cell-input",
"$ref": "#/$defs/SetCellInput",
"$defs": {
"Origin": {
"properties": {
"row": {
"type": "integer"
},
"col": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["row", "col"]
},
"SetCellInput": {
"properties": {
"spreadsheet_id": {
"type": "string"
},
"sheet_name": {
"type": "string"
},
"location": {
"$ref": "#/$defs/Origin"
},
"set_value": {
"$ref": "#/$defs/ValueField"
}
},
"additionalProperties": false,
"type": "object",
"required": ["spreadsheet_id", "sheet_name", "location", "set_value"]
},
"ValueField": {
"properties": {
"value": true,
"value_type": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": ["value", "value_type"]
}
}
}
Output
Example
{
"spreadsheet_id": "1234567890",
"sheet_name": "Sheet1",
"spreadsheet_url": "https://docs.google.com/spreadsheets/d/1234567890",
"location": {
"row": 0,
"col": 0
},
"set_value": {
"value": null,
"value_type": ""
},
"error": {
"is_error": false
}
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gsheets/set-cell-output",
"$ref": "#/$defs/SetCellOutput",
"$defs": {
"HandlerError": {
"properties": {
"is_error": {
"type": "boolean"
},
"errors": {
"items": {
"type": "string"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["is_error"]
},
"Origin": {
"properties": {
"row": {
"type": "integer"
},
"col": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["row", "col"]
},
"SetCellOutput": {
"properties": {
"spreadsheet_id": {
"type": "string"
},
"sheet_name": {
"type": "string"
},
"spreadsheet_url": {
"type": "string"
},
"location": {
"$ref": "#/$defs/Origin"
},
"set_value": {
"$ref": "#/$defs/ValueField"
},
"error": {
"$ref": "#/$defs/HandlerError"
}
},
"additionalProperties": false,
"type": "object",
"required": [
"spreadsheet_id",
"sheet_name",
"spreadsheet_url",
"location",
"set_value",
"error"
]
},
"ValueField": {
"properties": {
"value": true,
"value_type": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": ["value", "value_type"]
}
}
}