L2 Hub
Google
gsheets
Get Spreadsheet Data

L2 Construct: get_spreadsheet_data

sheets google

Description

GetSpreadsheetData retrieves data from a Google Sheets spreadsheet. It fetches all sheets in the specified spreadsheet and returns their contents. Each sheet's data is represented as a Table with headers and rows. The function requires valid Google Sheets API credentials and permissions to access the spreadsheet.

L2 Data

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

Example Step

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

Input

Example

{
  "spreadsheet_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/google/gsheets/get-spreadsheet-data-input",
  "$ref": "#/$defs/GetSpreadsheetDataInput",
  "$defs": {
    "GetSpreadsheetDataInput": {
      "properties": {
        "spreadsheet_id": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["spreadsheet_id"]
    }
  }
}
 

Output

Example

{
  "sheets": {
    "Sheet1": {
      "headers": ["Name", "Age", "City"],
      "rows": [["Alice", 30, "New York"], ["Bob", 25, "San Francisco"]]
    },
    "Sheet2": {
      "headers": ["Product", "Price", "Quantity"],
      "rows": [["Widget", 9.99, 100], ["Gadget", 24.99, 50]]
    }
  }
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/google/gsheets/get-spreadsheet-data-output",
  "$ref": "#/$defs/GetSpreadsheetDataOutput",
  "$defs": {
    "GetSpreadsheetDataOutput": {
      "properties": {
        "sheets": {
          "additionalProperties": {
            "$ref": "#/$defs/Table"
          },
          "type": "object"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["sheets"]
    },
    "Table": {
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "headers": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "rows": {
          "items": {
            "items": true,
            "type": "array"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["headers", "rows"]
    }
  }
}