Sheets
albert.resources.sheets
Attributes:
| Name | Type | Description |
|---|---|---|
CellAttributeValue |
|
CellChangeId
CellChangePayload
CellColor
CellType
DesignType
Cell
Bases: BaseResource
A Cell in a Sheet
Attributes:
| Name | Type | Description |
|---|---|---|
column_id |
str
|
The column ID of the cell. |
row_id |
str
|
The row ID of the cell. |
value |
str | dict
|
The value of the cell. If the cell is an inventory item, this will be a dict. |
min_value |
str | None
|
The minimum allowed value for inventory cells. Optional. |
max_value |
str | None
|
The maximum allowed value for inventory cells. Optional. |
row_label_name |
(str, optional)
|
The display name of the row. |
type |
CellType | str
|
The type of the cell. Allowed values are the same as for CellType. |
row_type |
(CellType, optional)
|
The type of the row containing this cell. Usually one of INV (inventory row), TOT (total row), TAS (task row), TAG, PRC, PDC, BAT or BLK. |
name |
str | None
|
The name of the cell. Optional. Default is None. |
calculation |
str
|
The calculation of the cell. Optional. Default is "". |
design_id |
str
|
The design ID of the design this cell is in. |
format |
dict
|
The format of the cell. Optional. Default is {}. The format is a dict with the keys |
raw_value |
str
|
The raw value of the cell. If the cell is an inventory item, this will be the value of the inventory item. Read-only. |
color |
str | None
|
The color of the cell. Read only. |
Component
Bases: BaseResource
Represents an amount of an inventory item in a formulation.
Attributes:
| Name | Type | Description |
|---|---|---|
inventory_item |
InventoryItem | None
|
The inventory item in the component. Optional when |
inventory_id |
InventoryId | None
|
The inventory identifier backing the component. Automatically populated from
|
amount |
float
|
The amount of the inventory item in the component. |
cell |
Cell
|
The cell that the component is in. Read-only. |
DesignState
Design
Bases: BaseSessionResource
A Design in a Sheet. Designs are sheet subsections that are largly abstracted away from the user.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The Albert ID of the design. |
design_type |
DesignType
|
The type of the design. Allowed values are the same as for DesignType. |
state |
DesignState | None
|
The state of the design. Optional. Default is None. |
grid |
DataFrame | None
|
The grid of the design. Optional. Default is None. Read-only. |
rows |
list[Row] | None
|
The rows of the design. Optional. Default is None. Read-only. |
columns |
list[Column] | None
|
The columns of the design. Optional. Default is None. Read-only. |
SheetFormulationRef
Bases: BaseAlbertModel
A reference to a formulation in a sheet
Show JSON schema:
{
"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": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "The name of the formulation",
"title": "Name"
},
"hidden": {
"description": "Whether the formulation is hidden",
"title": "Hidden",
"type": "boolean"
}
},
"required": [
"id",
"hidden"
],
"title": "SheetFormulationRef",
"type": "object"
}
Fields:
Sheet
Bases: BaseSessionResource
A Sheet in Albert
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The Albert ID of the sheet. |
name |
str
|
The name of the sheet. |
hidden |
bool
|
Whether the sheet is hidden. |
designs |
list[Design]
|
The designs of the sheet. |
project_id |
str
|
The Albert ID of the project the sheet is in. |
grid |
DataFrame | None
|
The grid of the sheet. Optional. Default is None. Read-only. |
columns |
list[Column]
|
The columns of the sheet. Read-only. |
rows |
list[Row]
|
The rows of the sheet. Read-only. |
Methods:
| Name | Description |
|---|---|
set_session |
|
set_sheet_fields |
|
rename |
|
add_formulation |
|
add_formulation_columns |
|
add_blank_row |
|
add_inventory_row |
|
update_cells |
|
add_blank_column |
|
delete_column |
|
delete_row |
|
get_column |
Retrieve a Column by its colId, underlying inventory ID, or display header name. |
lock_column |
Lock or unlock a column in the sheet. |
formulations
formulations: list[SheetFormulationRef] = Field(
default_factory=list, alias="Formulas"
)
set_session
set_sheet_fields
set_sheet_fields() -> Sheet
Source code in src/albert/resources/sheets.py
add_formulation
add_formulation(
*,
formulation_name: str,
components: list[Component],
inventory_id: InventoryId | None = None,
enforce_order: bool = False,
clear: bool = True,
) -> Column
Source code in src/albert/resources/sheets.py
add_formulation_columns
add_formulation_columns(
*,
formulation_names: list[str],
starting_position: dict | None = None,
) -> list[Column]
Source code in src/albert/resources/sheets.py
add_blank_row
add_blank_row(
*,
row_name: str,
design: DesignType = PRODUCTS,
position: dict | None = None,
)
Source code in src/albert/resources/sheets.py
add_inventory_row
Source code in src/albert/resources/sheets.py
update_cells
Source code in src/albert/resources/sheets.py
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | |
add_blank_column
Source code in src/albert/resources/sheets.py
delete_column
delete_column(*, column_id: str) -> None
Source code in src/albert/resources/sheets.py
delete_row
Source code in src/albert/resources/sheets.py
get_column
get_column(
*,
column_id: str | None = None,
inventory_id: InventoryId | None = None,
column_name: str | None = None,
) -> Column
Retrieve a Column by its colId, underlying inventory ID, or display header name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_id
|
str | None
|
The sheet column ID to match (e.g. "COL5"). |
None
|
inventory_id
|
str | None
|
The internal inventory identifier to match (e.g. "INVP015-001"). |
None
|
column_name
|
str | None
|
The human-readable header name of the column (e.g. "p1"). |
None
|
Returns:
| Type | Description |
|---|---|
Column
|
The matching Column object. |
Raises:
| Type | Description |
|---|---|
AlbertException
|
If no matching column is found or if multiple matches exist. |
Source code in src/albert/resources/sheets.py
lock_column
lock_column(
*,
column_id: str | None = None,
inventory_id: InventoryId | None = None,
column_name: str | None = None,
locked: bool = True,
) -> Column
Lock or unlock a column in the sheet.
The column can be specified by its sheet column ID (e.g. "COL5"),
by the underlying inventory identifier of a formulation/product, or by
the displayed header name. By default the column will be locked; pass
locked=False to unlock it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_id
|
str | None
|
The sheet column ID to match. |
None
|
inventory_id
|
str | None
|
The inventory identifier of the formulation or product to match. |
None
|
column_name
|
str | None
|
The displayed header name of the column. |
None
|
locked
|
bool
|
Whether to lock ( |
True
|
Returns:
| Type | Description |
|---|---|
Column
|
The column that was updated. |
Source code in src/albert/resources/sheets.py
Column
Bases: BaseSessionResource
A column in a Sheet
Attributes:
| Name | Type | Description |
|---|---|---|
column_id |
str
|
The column ID of the column. |
name |
str | None
|
The name of the column. Optional. Default is None. |
type |
CellType | str
|
The type of the column. Allowed values are the same as for CellType. |
sheet |
Sheet
|
The sheet the column is in. |
cells |
list[Cell]
|
The cells in the column. Read-only. |
df_name |
str
|
The name of the column in the DataFrame. Read-only |
Methods:
| Name | Description |
|---|---|
rename |
|
recolor_cells |
|
rename
Source code in src/albert/resources/sheets.py
recolor_cells
recolor_cells(color: CellColor)
Row
Bases: BaseSessionResource
A row in a Sheet
Attributes:
| Name | Type | Description |
|---|---|---|
row_id |
str
|
The row ID of the row. |
type |
CellType | str
|
The type of the row. Allowed values are the same as for CellType. |
design |
Design
|
The design the row is in. |
sheet |
Sheet
|
The sheet the row is in. |
name |
str | None
|
The name of the row. Optional. Default is None. |
inventory_id |
str | None
|
The inventory ID of the row. Optional. Default is None. |
manufacturer |
str | None
|
The manufacturer of the row. Optional. Default is None. |
row_unique_id |
str
|
The unique ID of the row. Read-only. |
cells |
list[Cell]
|
The cells in the row. Read-only. |
Methods:
| Name | Description |
|---|---|
recolor_cells |
|