L2 Construct: create_charts
sheets google chartsDescription
CreateCharts creates new charts in an existing Google Sheets spreadsheet. It supports creating both simple charts (with a single series of data) and complex charts (with multiple series of data). The function returns the IDs of the created charts, which can be used for future reference or modification.
L2 Data
- Provider: google
- Module: gsheets
- Action: create_charts
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "google",
"module": "gsheets",
"action": "create_charts",
"metadata": {}
}
}
Input
Example
{
"spreadsheet_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
"simple_charts": [
{
"title": "Monthly Revenue",
"type": "BAR",
"sheet_name": "Revenue",
"headers": {
"orientation": "horizontal",
"start_row_number": 0,
"start_col_number": 0,
"length": 4
},
"values": {
"orientation": "vertical",
"start_row_number": 1,
"start_col_number": 1,
"length": 3
}
}
],
"charts": [
{
"title": "Expense Breakdown",
"type": "COLUMN",
"sheet_name": "Expenses",
"headers": {
"orientation": "vertical",
"start_row_number": 1,
"start_col_number": 0,
"length": 3
},
"values": {
"start_row_number": 0,
"start_col_number": 1,
"end_row_number": 4,
"end_col_number": 4
}
}
]
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gsheets/create-charts-input",
"$ref": "#/$defs/CreateChartsInput",
"$defs": {
"Chart": {
"properties": {
"title": {
"type": "string"
},
"type": {
"type": "string"
},
"sheet_name": {
"type": "string"
},
"headers": {
"$ref": "#/$defs/Series"
},
"values": {
"$ref": "#/$defs/Frame"
}
},
"additionalProperties": false,
"type": "object",
"required": ["title", "type", "sheet_name", "headers", "values"]
},
"CreateChartsInput": {
"properties": {
"spreadsheet_id": {
"type": "string"
},
"simple_charts": {
"items": {
"$ref": "#/$defs/SimpleChart"
},
"type": "array"
},
"charts": {
"items": {
"$ref": "#/$defs/Chart"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["spreadsheet_id"]
},
"Frame": {
"properties": {
"start_row_number": {
"type": "integer"
},
"start_col_number": {
"type": "integer"
},
"end_row_number": {
"type": "integer"
},
"end_col_number": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["start_row_number", "start_col_number"]
},
"Series": {
"properties": {
"orientation": {
"type": "string"
},
"start_row_number": {
"type": "integer"
},
"start_col_number": {
"type": "integer"
},
"length": {
"type": "integer"
}
},
"additionalProperties": false,
"type": "object",
"required": ["orientation", "start_row_number", "start_col_number"]
},
"SimpleChart": {
"properties": {
"title": {
"type": "string"
},
"type": {
"type": "string"
},
"sheet_name": {
"type": "string"
},
"headers": {
"$ref": "#/$defs/Series"
},
"values": {
"$ref": "#/$defs/Series"
}
},
"additionalProperties": false,
"type": "object",
"required": ["title", "type", "headers", "values"]
}
}
}
Output
Example
{
"chart_ids": {
"Expense Breakdown": 9876543210,
"Monthly Revenue": 1234567890
}
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gsheets/create-charts-output",
"$ref": "#/$defs/CreateChartsOutput",
"$defs": {
"CreateChartsOutput": {
"properties": {
"chart_ids": {
"additionalProperties": {
"type": "integer"
},
"type": "object"
}
},
"additionalProperties": false,
"type": "object",
"required": ["chart_ids"]
}
}
}