L2 Hub
Google
gsheets
Create Charts in Sheets

L2 Construct: create_charts_in_sheets

sheets google charts

Description

CreateChartsInSheet creates new charts in an existing Google Sheets spreadsheet. It supports creating simple charts (with a single series of data) in the specified sheet. The function returns the IDs of the created charts, which can be used for future reference or modification.

L2 Data

  1. Provider: google
  2. Module: gsheets
  3. Action: create_charts_in_sheets

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "google",
    "module": "gsheets",
    "action": "create_charts_in_sheets",
    "metadata": {}
  }
}
 

Input

Example

{
  "spreadsheet_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
  "sheet_name": "Revenue",
  "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
      }
    }
  ]
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/google/gsheets/create-charts-in-sheet-input",
  "$ref": "#/$defs/CreateChartsInSheetInput",
  "$defs": {
    "CreateChartsInSheetInput": {
      "properties": {
        "spreadsheet_id": {
          "type": "string"
        },
        "sheet_name": {
          "type": "string"
        },
        "simple_charts": {
          "items": {
            "$ref": "#/$defs/SimpleChart"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["spreadsheet_id", "sheet_name", "simple_charts"]
    },
    "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

{
  "spreadsheet_id": "",
  "sheet_name": "",
  "chart_ids": [1234567890]
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/google/gsheets/create-charts-in-sheet-output",
  "$ref": "#/$defs/CreateChartsInSheetOutput",
  "$defs": {
    "CreateChartsInSheetOutput": {
      "properties": {
        "spreadsheet_id": {
          "type": "string"
        },
        "sheet_name": {
          "type": "string"
        },
        "chart_ids": {
          "items": {
            "type": "integer"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["spreadsheet_id", "sheet_name", "chart_ids"]
    }
  }
}