Worksheets
albert.collections.worksheets.WorksheetCollection
Bases: BaseCollection
Manage Worksheets in the Albert platform.
A Worksheet is the Excel-like command center where formulations are designed.
Each Worksheet is paired one-to-one with a Project (Project)
and is retrieved by that Project's ID with get_by_project_id.
A Worksheet holds one or more Sheets (Sheet).
Each Sheet is an interactive grid organized into stacked sections (given by
DesignType): Product Design (where
formulations are built), Process Design, Results (Property Tasks and their
data), and Apps (insights and notes). Building a formulation on a Sheet is
what registers a Formula inventory item
(InventoryItem): Formulas originate
here rather than through the Inventory collection.
This collection manages Worksheet- and Sheet-level structure (retrieving a
Worksheet, adding Sheets, duplicating Sheets, and creating Sheet templates).
Editing the contents of a Sheet (columns, rows, cells, and formulations) is
done through the returned Sheet objects.
This collection is accessed as client.worksheets.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
str
|
The base API route for worksheet requests. |
Methods:
| Name | Description |
|---|---|
get_by_project_id |
Get the Worksheet paired with a Project. |
search |
Search for formulas across Worksheets matching the given filters. |
setup_worksheet |
Initialize a Worksheet for a Project that does not yet have one. |
add_sheet |
Add a new blank Sheet to a Worksheet. |
setup_new_sheet_from_template |
Add a new Sheet built from an existing Sheet template. |
duplicate_sheet |
Copy an existing Sheet into a new Sheet within the same Project. |
create_sheet_template |
Save an existing Sheet as a reusable Sheet template. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The authenticated Albert session used for API calls. |
required |
Source code in src/albert/collections/worksheets.py
get_by_project_id
Get the Worksheet paired with a Project.
Projects and Worksheets are one-to-one in Albert, so a Project ID uniquely
identifies a Worksheet. This is the usual entry point for working with a
Worksheet: the returned object exposes its Sheets
(Sheet), each of which can then be
edited in place.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
ProjectId
|
The ID of the Project whose Worksheet to retrieve (format |
required |
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet paired with the Project. |
Source code in src/albert/collections/worksheets.py
search
search(
*,
text: str | None = None,
project_id: SearchProjectId | None = None,
sheet_id: str | None = None,
tags: str | list[str] | None = None,
albert_id: str | list[str] | None = None,
state: str | list[str] | None = None,
predecessor: str | list[str] | None = None,
data_template: str | list[str] | None = None,
inventory_name: str | list[str] | None = None,
inventory_id: str | list[str] | None = None,
formula_created_by: str | list[str] | None = None,
facet_text: str | None = None,
facet_field: str | None = None,
contains_field: str | list[str] | None = None,
contains_text: str | list[str] | None = None,
exclude_hidden: bool | None = None,
sort_by: str | None = None,
order: OrderBy | None = None,
max_items: int | None = None,
) -> Iterator[WorksheetSearchItem]
Search for formulas across Worksheets matching the given filters.
Returns lightweight, partially populated
WorksheetSearchItem
results and is the fastest way to discover formulations across Projects and
Sheets. Results are returned as a lazily paginated iterator. When you need
the complete formula, pass a result's id to
get_by_id.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Free-text query matched against formula fields. |
None
|
project_id
|
SearchProjectId
|
Scope the search to a Project (format |
None
|
sheet_id
|
str
|
Filter to formulas on a given Sheet. |
None
|
tags
|
str or list[str]
|
Filter by tag name(s). |
None
|
albert_id
|
str or list[str]
|
Filter by formula inventory ID(s) (format |
None
|
state
|
str or list[str]
|
Filter by formula state (e.g. locked or unlocked). |
None
|
predecessor
|
str or list[str]
|
Filter by predecessor formula. |
None
|
data_template
|
str or list[str]
|
Filter by data template name(s). |
None
|
inventory_name
|
str or list[str]
|
Filter by ingredient name(s). |
None
|
inventory_id
|
str or list[str]
|
Filter by ingredient inventory ID(s). |
None
|
formula_created_by
|
str or list[str]
|
Filter by formula creator(s). |
None
|
facet_text
|
str
|
Text to match within a facet search. |
None
|
facet_field
|
str
|
Field to search within for facet filtering. |
None
|
contains_field
|
str or list[str]
|
Field(s) to apply a "contains" search to. |
None
|
contains_text
|
str or list[str]
|
Text value(s) for the "contains" search. |
None
|
exclude_hidden
|
bool
|
When True, omit hidden formulas from the results. |
None
|
sort_by
|
str
|
Field to sort results by. |
None
|
order
|
OrderBy
|
The order in which to sort results ( |
None
|
max_items
|
int
|
Maximum number of items to return in total. If None, iterates over all matches. |
None
|
Returns:
| Type | Description |
|---|---|
Iterator[WorksheetSearchItem]
|
A lazily paginated iterator of matching formula search results. |
Source code in src/albert/collections/worksheets.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
setup_worksheet
Initialize a Worksheet for a Project that does not yet have one.
Most Projects already have a Worksheet; use this only when a Project's
Worksheet has not been set up. To retrieve an existing Worksheet, use
get_by_project_id.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
ProjectId
|
The ID of the Project to set up the Worksheet for (format |
required |
add_sheet
|
bool
|
When True, a blank Sheet is added to the new Worksheet. Default is False. |
False
|
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet for the Project. |
Source code in src/albert/collections/worksheets.py
setup_new_sheet_from_template
setup_new_sheet_from_template(
*,
project_id: ProjectId,
sheet_template_id: str,
sheet_name: str,
) -> Worksheet
Add a new Sheet to a Project's Worksheet, built from a Sheet template.
The template supplies the starting structure (columns and rows) for the
new Sheet. Sheet templates are created with create_sheet_template.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
ProjectId
|
The ID of the Project whose Worksheet the Sheet is added to (format |
required |
sheet_template_id
|
str
|
The ID of the Sheet template to build the new Sheet from. |
required |
sheet_name
|
str
|
The name of the new Sheet. |
required |
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet, now including the newly created Sheet. |
Source code in src/albert/collections/worksheets.py
add_sheet
Add a new blank Sheet to a Project's Worksheet.
The new Sheet starts empty. To start from an existing structure instead,
use setup_new_sheet_from_template or duplicate_sheet.
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
ProjectId
|
The ID of the Project whose Worksheet the Sheet is added to (format |
required |
sheet_name
|
str
|
The name of the new Sheet. |
required |
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet, now including the newly created Sheet. |
Source code in src/albert/collections/worksheets.py
duplicate_sheet
duplicate_sheet(
*,
project_id: ProjectId,
source_sheet_name: str,
new_sheet_name: str,
copy_all_pd_rows: bool = True,
copy_all_pinned_columns: bool = True,
copy_all_unpinned_columns: bool = True,
column_names: list[str] | None = None,
task_row_names: list[str] | None = None,
) -> Worksheet
Copy an existing Sheet into a new Sheet within the same Project.
The new Sheet is created from the named source Sheet. You control which Product Design rows and columns are carried over using the options below. The final set of columns copied is the union of:
- all pinned columns (if
copy_all_pinned_columnsis True) - all unpinned columns (if
copy_all_unpinned_columnsis True) - explicitly listed column names (
column_names)
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
ProjectId
|
The ID of the Project the source Sheet belongs to (format |
required |
source_sheet_name
|
str
|
The name of the existing Sheet to duplicate. |
required |
new_sheet_name
|
str
|
The name of the new Sheet to create. |
required |
copy_all_pd_rows
|
bool
|
When True, all Product Design rows from the source Sheet are copied. When False, only rows corresponding to the selected columns are copied. Default is True. |
True
|
copy_all_pinned_columns
|
bool
|
When True, includes all pinned columns from the source Sheet. Default is True. |
True
|
copy_all_unpinned_columns
|
bool
|
When True, includes all unpinned columns from the source Sheet. Default is True. |
True
|
column_names
|
list[str]
|
Column names to explicitly copy. These are resolved internally to column IDs using the source Sheet's Product Design grid. |
None
|
task_row_names
|
list[str]
|
Names of task rows to include from the source Sheet's Tasks. |
None
|
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet, now including the newly created Sheet. |
Source code in src/albert/collections/worksheets.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
create_sheet_template
create_sheet_template(
*,
project_id: ProjectId,
source_sheet_name: str,
template_name: str,
copy_all_pd_rows: bool = True,
copy_all_pinned_columns: bool = True,
copy_all_unpinned_columns: bool = True,
column_names: list[str] | None = None,
task_row_names: list[str] | None = None,
prg_row_names: list[str] | None = None,
acl: ACLContainer | None = None,
) -> CustomTemplate
Save an existing Sheet as a reusable Sheet template.
The template captures the structure of the source Sheet so new Sheets can
be built from it later with setup_new_sheet_from_template. At least
one column must be selected, or a ValueError is raised. The set of
columns saved is the union of pinned columns, unpinned columns, and any
explicitly listed column_names (per the flags below).
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
ProjectId
|
The ID of the Project the source Sheet belongs to (format |
required |
source_sheet_name
|
str
|
The name of the existing Sheet to use as the template source. |
required |
template_name
|
str
|
The name of the new template. |
required |
copy_all_pd_rows
|
bool
|
When True, all Product Design rows from the source Sheet are copied. When False, only rows corresponding to the selected columns are copied. Default is True. |
True
|
copy_all_pinned_columns
|
bool
|
When True, includes all pinned columns from the source Sheet. Default is True. |
True
|
copy_all_unpinned_columns
|
bool
|
When True, includes all unpinned columns from the source Sheet. Default is True. |
True
|
column_names
|
list[str]
|
Column names to explicitly copy. These are resolved internally to column IDs using the source Sheet's Product Design grid. |
None
|
task_row_names
|
list[str]
|
Names of task rows to include from the source Sheet's Tasks. |
None
|
prg_row_names
|
list[str]
|
Names of parameter group rows to include. |
None
|
acl
|
ACLContainer
|
Access control settings for the template. |
None
|
Returns:
| Type | Description |
|---|---|
CustomTemplate
|
The created Sheet template. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no columns are selected to include in the template. |
Source code in src/albert/collections/worksheets.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | |