Worksheets
albert.collections.worksheets.WorksheetCollection
Bases: BaseCollection
WorksheetCollection is a collection class for managing Worksheet entities in the Albert platform.
Methods:
| Name | Description |
|---|---|
get_by_project_id |
Retrieve a worksheet by its project ID. Projects and Worksheets are 1:1 in the Albert platform. |
setup_worksheet |
Setup a new worksheet for a project. |
setup_new_sheet_from_template |
Create a new sheet in the Worksheet related to the specified Project from a template. |
add_sheet |
Create a new blank sheet in the Worksheet with the specified name. |
duplicate_sheet |
Duplicate an existing sheet within the same project. |
create_sheet_template |
Create a new sheet template from an existing sheet. |
Attributes:
| Name | Type | Description |
|---|---|---|
base_path |
|
Source code in src/albert/collections/worksheets.py
get_by_project_id
Retrieve a worksheet by its project ID. Projects and Worksheets are 1:1 in the Albert platform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
str
|
The project ID to retrieve the worksheet for. |
required |
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet object for that project. |
Source code in src/albert/collections/worksheets.py
setup_worksheet
Setup a new worksheet for a project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
str
|
The project ID to setup the worksheet for. |
required |
add_sheet
|
bool
|
Whether to add a blank sheet to the worksheet, by default False |
False
|
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet object 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
Create a new sheet in the Worksheet related to the specified Project from a template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
str
|
description |
required |
sheet_template_id
|
str
|
description |
required |
sheet_name
|
str
|
description |
required |
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet object for the project. |
Source code in src/albert/collections/worksheets.py
add_sheet
Create a new blank sheet in the Worksheet with the specified name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
str
|
The project ID for the Worksheet to add the sheet to. |
required |
sheet_name
|
str
|
The name of the new sheet. |
required |
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet object for the project. |
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
Duplicate an existing sheet within the same project.
This creates a new sheet based on the specified source sheet. You can control which Product Design (PD) & Results rows and columns are copied using the available options. The final list of columns copied is the union of: - all pinned columns (if copy_all_pinned_columns is True) - all unpinned columns (if copy_all_unpinned_columns is True) - explicitly listed column names (column_names)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
str
|
The project ID under which the sheet exists. |
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 PD (Product Design) rows from the source sheet are copied. When False, only rows corresponding to the selected columns will be copied. Default is True. |
True
|
copy_all_pinned_columns
|
bool
|
If True, includes all pinned columns from the source sheet. Default is True. |
True
|
copy_all_unpinned_columns
|
bool
|
If True, includes all unpinned columns from the source sheet. Default is True. |
True
|
column_names
|
list[str]
|
A list of column names to explicitly copy. These are resolved internally to column IDs using the sheet's product design grid. |
None
|
task_row_names
|
list[str]
|
List of task row names to include from the tasks. |
None
|
Returns:
| Type | Description |
|---|---|
Worksheet
|
The Worksheet entity containing newly created sheet. |
Source code in src/albert/collections/worksheets.py
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
Create a new sheet template from an existing sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_id
|
str
|
The project ID under which the sheet exists. |
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 PD (Product Design) rows from the source sheet are copied. When False, only rows corresponding to the selected columns will be copied. |
True
|
copy_all_pinned_columns
|
bool
|
If True, includes all pinned columns from the source sheet. Default is True. |
True
|
copy_all_unpinned_columns
|
bool
|
If True, includes all unpinned columns from the source sheet. Default is True. |
True
|
column_names
|
list[str]
|
A list of column names to explicitly copy. These are resolved internally to column IDs using the sheet's product design grid. |
None
|
task_row_names
|
list[str]
|
List of task row names to include from the tasks. |
None
|
prg_row_names
|
list[str]
|
List of parameter group row names to include. |
None
|
acl
|
ACLContainer
|
ACL for the template. |
None
|
Returns:
| Type | Description |
|---|---|
CustomTemplate
|
The CustomTemplate for the created sheet template. |
Source code in src/albert/collections/worksheets.py
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 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |