Skip to content

Worksheets

albert.resources.worksheets

Worksheet

Worksheet(**data)

Bases: BaseSessionResource

A worksheet entity.

Attributes:

Name Type Description
sheets List[Sheet]

A list of sheet entities.

project_name str | None

The name of the project.

sheets_enabled bool

Whether the sheets are enabled.

project_id str

The Albert ID of the project.

Show JSON schema:
{
  "$defs": {
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    },
    "Design": {
      "description": "A Design in a Sheet. Designs are sheet subsections that are largly abstracted away from the user.\n\nAttributes\n----------\nid : str\n    The Albert ID of the design.\ndesign_type : DesignType\n    The type of the design. Allowed values are `apps`, `products`, and `results`.\nstate : DesignState | None\n    The state of the design. Optional. Default is None.\ngrid : pd.DataFrame | None\n    The grid of the design. Optional. Default is None. Read-only.\nrows : list[Row] | None\n    The rows of the design. Optional. Default is None. Read-only.\ncolumns : list[Column] | None\n    The columns of the design. Optional. Default is None. Read-only.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "state": {
          "anyOf": [
            {
              "$ref": "#/$defs/DesignState"
            },
            {
              "type": "null"
            }
          ],
          "default": {}
        },
        "albertId": {
          "title": "Albertid",
          "type": "string"
        },
        "designType": {
          "$ref": "#/$defs/DesignType"
        }
      },
      "required": [
        "albertId",
        "designType"
      ],
      "title": "Design",
      "type": "object"
    },
    "DesignState": {
      "description": "The state of a Design",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "collapsed": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": false,
          "title": "Collapsed"
        }
      },
      "title": "DesignState",
      "type": "object"
    },
    "DesignType": {
      "description": "The type of Design",
      "enum": [
        "apps",
        "products",
        "results"
      ],
      "title": "DesignType",
      "type": "string"
    },
    "Sheet": {
      "description": "A Sheet in Albert\n\nAttributes\n----------\nid : str\n    The Albert ID of the sheet.\nname : str\n    The name of the sheet.\nhidden : bool\n    Whether the sheet is hidden.\ndesigns : list[Design]\n    The designs of the sheet.\nproject_id : str\n    The Albert ID of the project the sheet is in.\ngrid : pd.DataFrame | None\n    The grid of the sheet. Optional. Default is None. Read-only.\ncolumns : list[Column]\n    The columns of the sheet. Read-only.\nrows : list[Row]\n    The rows of the sheet. Read-only.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "albertId": {
          "title": "Albertid",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "Formulas": {
          "items": {
            "$ref": "#/$defs/SheetFormulationRef"
          },
          "title": "Formulas",
          "type": "array"
        },
        "hidden": {
          "title": "Hidden",
          "type": "boolean"
        },
        "Designs": {
          "items": {
            "$ref": "#/$defs/Design"
          },
          "title": "Designs",
          "type": "array"
        },
        "project_id": {
          "title": "Project Id",
          "type": "string"
        }
      },
      "required": [
        "albertId",
        "name",
        "hidden",
        "Designs",
        "project_id"
      ],
      "title": "Sheet",
      "type": "object"
    },
    "SheetFormulationRef": {
      "description": "A reference to a formulation in a sheet",
      "properties": {
        "id": {
          "description": "The Albert ID of the inventory item that is the formulation",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "The name of the formulation",
          "title": "Name",
          "type": "string"
        },
        "hidden": {
          "description": "Whether the formulation is hidden",
          "title": "Hidden",
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "name",
        "hidden"
      ],
      "title": "SheetFormulationRef",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "A worksheet entity.\n\nAttributes\n----------\nsheets : List[Sheet]\n    A list of sheet entities.\nproject_name : str | None\n    The name of the project.\nsheets_enabled : bool\n    Whether the sheets are enabled.\nproject_id : str\n    The Albert ID of the project.",
  "properties": {
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/Status"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "Sheets": {
      "items": {
        "$ref": "#/$defs/Sheet"
      },
      "title": "Sheets",
      "type": "array"
    },
    "projectName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Projectname"
    },
    "sheetEnabled": {
      "default": true,
      "title": "Sheetenabled",
      "type": "boolean"
    },
    "projectId": {
      "title": "Projectid",
      "type": "string"
    }
  },
  "required": [
    "Sheets",
    "projectId"
  ],
  "title": "Worksheet",
  "type": "object"
}

Fields:

Validators:

Source code in src/albert/resources/base.py
def __init__(self, **data):
    super().__init__(**data)
    self._session = data.get("session")

sheets

sheets: list[Sheet]

project_name

project_name: str | None = None

sheets_enabled

sheets_enabled: bool = True

project_id

project_id: str

add_session_to_sheets

add_session_to_sheets()
Source code in src/albert/resources/worksheets.py
@model_validator(mode="after")
def add_session_to_sheets(self):
    if self.session is not None:
        for s in self.sheets:
            s._session = self.session
            for d in s.designs:
                d._session = self.session
    return self