L2 Construct: create_spreadsheet
sheets googleDescription
CreateSpreadsheetWithSheets creates a new Google Sheets spreadsheet with multiple sheets. It initializes the spreadsheet with the specified name, creates individual sheets based on the provided data, populates each sheet with the corresponding tabular data, and returns the ID, name, and URL of the newly created spreadsheet.
L2 Data
- Provider: google
- Module: gsheets
- Action: create_spreadsheet
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "google",
"module": "gsheets",
"action": "create_spreadsheet"
}
}
Input
Example
{
"spreadsheet_name": "Q2 2023 Financial Report",
"sheets": {
"Expenses": {
"headers": ["Category", "April", "May", "June"],
"rows": [
["Salaries", 50000, 50000, 52000],
["Marketing", 10000, 12000, 15000],
["Operations", 8000, 8500, 9000]
]
},
"Revenue": {
"headers": ["Month", "Product A", "Product B", "Total"],
"rows": [
["April", 10000, 15000, 25000],
["May", 12000, 18000, 30000],
["June", 15000, 20000, 35000]
]
}
}
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gsheets/create-spreadsheet-with-sheets-input",
"$ref": "#/$defs/CreateSpreadsheetWithSheetsInput",
"$defs": {
"CreateSpreadsheetWithSheetsInput": {
"properties": {
"spreadsheet_name": {
"type": "string"
},
"sheets": {
"additionalProperties": {
"$ref": "#/$defs/Table"
},
"type": "object"
}
},
"additionalProperties": false,
"type": "object",
"required": ["spreadsheet_name", "sheets"]
},
"Table": {
"properties": {
"headers": {
"items": {
"type": "string"
},
"type": "array"
},
"rows": {
"items": {
"items": true,
"type": "array"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["headers", "rows"]
}
}
}
Output
Example
{
"spreadsheet_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
"spreadsheet_name": "Q2 2023 Financial Report",
"spreadsheet_url": "https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit"
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/google/gsheets/create-spreadsheet-with-sheets-output",
"$ref": "#/$defs/CreateSpreadsheetWithSheetsOutput",
"$defs": {
"CreateSpreadsheetWithSheetsOutput": {
"properties": {
"spreadsheet_id": {
"type": "string"
},
"spreadsheet_name": {
"type": "string"
},
"spreadsheet_url": {
"type": "string"
}
},
"additionalProperties": false,
"type": "object",
"required": ["spreadsheet_id", "spreadsheet_name", "spreadsheet_url"]
}
}
}