L2 Hub
Google
gsheets
Get Sheet

L2 Construct: get_sheet

sheets google

Description

GetSheet retrieves data from a Google Sheets spreadsheet. It fetches the specified sheet from the spreadsheet and returns its contents 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_sheet

Example Step

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

Input

Example

{
  "spreadsheet_id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
  "sheet_name": "Sheet1"
}
 

Schema

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

Output

Example

{
  "spreadsheet_id": "",
  "sheet_name": "",
  "table": {
    "headers": ["Name", "Age", "City"],
    "rows": [["Alice", 30, "New York"], ["Bob", 25, "San Francisco"]]
  }
}
 

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/google/gsheets/get-sheet-output",
  "$ref": "#/$defs/GetSheetOutput",
  "$defs": {
    "GetSheetOutput": {
      "properties": {
        "spreadsheet_id": {
          "type": "string"
        },
        "sheet_name": {
          "type": "string"
        },
        "table": {
          "$ref": "#/$defs/Table"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["spreadsheet_id", "sheet_name", "table"]
    },
    "Table": {
      "properties": {
        "headers": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "rows": {
          "items": {
            "items": true,
            "type": "array"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["headers", "rows"]
    }
  }
}