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. |
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
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
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
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
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 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 | |