Sheets
albert.resources.sheets
Attributes:
| Name | Type | Description |
|---|---|---|
CellAttributeValue |
|
CellChangeId
CellChangePayload
CellColor
CellType
DesignType
ColumnPosition
RowPosition
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
RowConfig
Bases: BaseAlbertModel
Configuration for an APP or location-type row.
Show JSON schema:
{
"description": "Configuration for an APP or location-type row.",
"properties": {
"option": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Option"
},
"value": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Value"
}
},
"title": "RowConfig",
"type": "object"
}
Fields:
RowGroup
Bases: BaseAlbertModel
A named group of rows within a Design.
Show JSON schema:
{
"description": "A named group of rows within a Design.",
"properties": {
"rowId": {
"title": "Rowid",
"type": "string"
},
"name": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"child_row_ids": {
"items": {
"type": "string"
},
"title": "Child Row Ids",
"type": "array"
}
},
"required": [
"rowId"
],
"title": "RowGroup",
"type": "object"
}
Fields:
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. |
Methods:
| Name | Description |
|---|---|
group_rows |
Create a named row group within this design. |
get_groups |
Get all row groups in this design. |
group_rows
group_rows(
*,
name: str,
child_row_ids: list[str],
reference_id: str | None = None,
position: str = "above",
) -> RowGroup
Create a row group within this design.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the row group. |
required |
child_row_ids
|
list[str]
|
Row IDs to include in the group. Must contain at least one ID. |
required |
reference_id
|
str
|
The reference row ID for insertion. Defaults to the first child row. |
None
|
position
|
str
|
Position relative to |
'above'
|
Returns:
| Type | Description |
|---|---|
RowGroup
|
The created row group. |
Source code in src/albert/resources/sheets.py
get_groups
Get all row groups in this design.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
refresh
|
bool
|
When True, re-fetches the group list even if cached. Default is False. |
False
|
Returns:
| Type | Description |
|---|---|
list[RowGroup]
|
The row groups in this design. |
Source code in src/albert/resources/sheets.py
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. |
is_column_right |
bool | None
|
When True, copied columns are placed to the right of the source column; when False, to the left. |
col_size_mode |
str | None
|
Column width sizing mode. Allowed values are |
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_components_to_formulation |
Add components to an existing formulation column without clearing other cells. |
add_formulation_columns |
|
add_blank_row |
|
add_inventory_row |
|
add_lookup_row |
Add a lookup (LKP) row to a design. |
add_app_row |
Add an application (APP) row to a design. |
update_cells |
|
add_blank_column |
Add a blank (BLK) column to this sheet. |
add_lookup_column |
Add a lookup (LKP) column to this sheet. |
add_function_column |
Add a function (FNC) column to this sheet. |
add_property_column |
Add a property/result (RSL) column to this sheet. |
pin_columns |
Pin one or more columns to the left or right edge of the sheet. |
unpin_columns |
Unpin one or more columns. |
set_columns_width |
Set the display width of one or more columns. |
hide_column |
Hide a column. |
show_column |
Show a hidden 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
772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | |
add_components_to_formulation
add_components_to_formulation(
*,
formulation_name: str | None = None,
column_id: str | None = None,
inventory_id: InventoryId | None = None,
components: list[Component],
enforce_order: bool = False,
) -> Column
Add components to an existing formulation column without clearing other cells.
Exactly one of column_id, inventory_id, or formulation_name must be provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formulation_name
|
str
|
The name of the formulation column. |
None
|
column_id
|
str
|
The column ID of the formulation column. |
None
|
inventory_id
|
str
|
The inventory ID of the formulation column. |
None
|
components
|
list[Component]
|
The components to append. |
required |
enforce_order
|
bool
|
When True, rows are inserted in the order of |
False
|
Returns:
| Type | Description |
|---|---|
Column
|
The updated formulation 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
add_lookup_row
add_lookup_row(
*,
name: str,
design: DesignType | str | None = APPS,
reference_id: str = "ROW1",
position: RowPosition = ABOVE,
) -> Row
Add a lookup (LKP) row to a design.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The display name of the new row. |
required |
design
|
DesignType or str
|
Which design to add the row to. Default is |
APPS
|
reference_id
|
str
|
The row ID to insert relative to. Defaults to |
'ROW1'
|
position
|
RowPosition
|
Whether to insert |
ABOVE
|
Returns:
| Type | Description |
|---|---|
Row
|
The created row. |
Source code in src/albert/resources/sheets.py
add_app_row
add_app_row(
*,
app_id: str,
name: str,
config: RowConfig | None = None,
design: DesignType | str | None = APPS,
reference_id: str = "ROW1",
position: RowPosition = ABOVE,
) -> Row
Add an application (APP) row to a design.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_id
|
str
|
The ID of the application. The |
required |
name
|
str
|
The display name of the row. |
required |
config
|
RowConfig
|
Row configuration ( |
None
|
design
|
DesignType or str
|
Which design to add the row to. Default is |
APPS
|
reference_id
|
str
|
The row ID to insert relative to. Defaults to |
'ROW1'
|
position
|
RowPosition
|
Whether to insert |
ABOVE
|
Returns:
| Type | Description |
|---|---|
Row
|
The created row. |
Source code in src/albert/resources/sheets.py
1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | |
update_cells
Source code in src/albert/resources/sheets.py
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 | |
add_blank_column
add_blank_column(
*,
name: str,
reference_id: str | None = None,
position: ColumnPosition = RIGHT_OF,
) -> Column
Add a blank (BLK) column to this sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The display name of the new column. |
required |
reference_id
|
str
|
The column ID to insert relative to. Defaults to the last column in the sheet. |
None
|
position
|
ColumnPosition
|
Whether to insert |
RIGHT_OF
|
Returns:
| Type | Description |
|---|---|
Column
|
The created column. |
Source code in src/albert/resources/sheets.py
add_lookup_column
add_lookup_column(
*,
name: str,
reference_id: str | None = None,
position: ColumnPosition = RIGHT_OF,
) -> Column
Add a lookup (LKP) column to this sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The display name of the new column. |
required |
reference_id
|
str
|
The column ID to insert relative to. Defaults to the last column in the sheet. |
None
|
position
|
ColumnPosition
|
Whether to insert |
RIGHT_OF
|
Returns:
| Type | Description |
|---|---|
Column
|
The created column. |
Source code in src/albert/resources/sheets.py
add_function_column
add_function_column(
*,
name: str,
reference_id: str | None = None,
position: ColumnPosition = RIGHT_OF,
) -> Column
Add a function (FNC) column to this sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The display name of the new column. |
required |
reference_id
|
str
|
The column ID to insert relative to. Defaults to the last column in the sheet. |
None
|
position
|
ColumnPosition
|
Whether to insert |
RIGHT_OF
|
Returns:
| Type | Description |
|---|---|
Column
|
The created column. |
Source code in src/albert/resources/sheets.py
add_property_column
add_property_column(
*,
name: str,
attribute_id: str,
data_column_id: DataColumnId | None = None,
data_column_name: str | None = None,
reference_id: str | None = None,
position: ColumnPosition = RIGHT_OF,
) -> Column
Add a property/result (RSL) column to this sheet.
Exactly one of data_column_id or data_column_name must be provided;
the other is fetched automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The display name of the new column. |
required |
attribute_id
|
str
|
The ID of the attribute (e.g. |
required |
data_column_id
|
DataColumnId
|
The data column ID (e.g. |
None
|
data_column_name
|
str
|
The data column name. Fetched from the API if omitted. |
None
|
reference_id
|
str
|
The column ID to insert relative to. Defaults to the last column in the sheet. |
None
|
position
|
ColumnPosition
|
Whether to insert |
RIGHT_OF
|
Returns:
| Type | Description |
|---|---|
Column
|
The created column. |
Source code in src/albert/resources/sheets.py
1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 | |
pin_columns
Pin one or more columns to the left or right edge of the sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col_ids
|
list[str]
|
The column IDs to pin. |
required |
side
|
'left' or 'right'
|
Which edge to pin to. |
required |
Source code in src/albert/resources/sheets.py
unpin_columns
Unpin one or more columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col_ids
|
list[str]
|
The column IDs to unpin. |
required |
Source code in src/albert/resources/sheets.py
set_columns_width
Set the display width of one or more columns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col_ids
|
list[str]
|
Column IDs to update. |
required |
width
|
str
|
Width value, e.g. |
required |
Source code in src/albert/resources/sheets.py
hide_column
hide_column(*, col_id: str) -> None
Hide a column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col_id
|
str
|
The column ID to hide. |
required |
Source code in src/albert/resources/sheets.py
show_column
show_column(*, col_id: str) -> None
Show a hidden column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
col_id
|
str
|
The column ID to show. |
required |
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. |
config |
RowConfig | None
|
Configuration for APP or location-scoped rows. Optional. Default is None. |
parent_row_id |
str | None
|
The row ID of the group header this row belongs to. None if not grouped. |
child_row_ids |
list[str]
|
Row IDs of rows grouped under this row. Non-empty only on group header rows. |
is_group_header |
bool
|
True when this row is the header of a row group. Read-only. |
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 |
|