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
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | |
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
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | |
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 |
|