Worksheets
albert.collections.worksheets
AlbertSession
AlbertSession(
*,
base_url: str,
token: str | None = None,
auth_manager: AlbertClientCredentials
| AlbertSSOClient
| None = None,
retries: int | None = None,
)
Bases: Session
A session that has a base URL, which is prefixed to all request URLs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
The base URL to prefix to all relative request paths (e.g., "https://app.albertinvent.com"). |
required |
token
|
str | None
|
A static JWT token for authentication. Ignored if |
None
|
auth_manager
|
AlbertClientCredentials | AlbertSSOClient
|
An authentication manager used to dynamically fetch and refresh tokens.
If provided, it overrides |
None
|
retries
|
int
|
The number of automatic retries on failed requests (default is 3). |
None
|
Methods:
| Name | Description |
|---|---|
request |
|
Source code in src/albert/core/session.py
request
Source code in src/albert/core/session.py
BaseCollection
BaseCollection(*, session: AlbertSession)
BaseCollection is the base class for all collection classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
AlbertSession
|
The Albert API Session instance. |
required |
Source code in src/albert/collections/base.py
Worksheet
Bases: BaseSessionResource
A worksheet entity.
Attributes:
| Name | Type | Description |
|---|---|---|
sheets |
List[Sheet]
|
A list of sheet entities. |
project_name |
str | None
|
The name of the project. |
sheets_enabled |
bool
|
Whether the sheets are enabled. |
project_id |
str
|
The Albert ID of the project. |
Methods:
| Name | Description |
|---|---|
add_session_to_sheets |
|
WorksheetCollection
WorksheetCollection(*, session: AlbertSession)
Bases: BaseCollection
WorksheetCollection is a collection class for managing Worksheet entities in the Albert platform.
Methods:
| Name | Description |
|---|---|
add_sheet |
Create a new blank sheet in the Worksheet with the specified name. |
get_by_project_id |
Retrieve a worksheet by its project ID. Projects and Worksheets are 1:1 in the Albert platform. |
setup_new_sheet_from_template |
Create a new sheet in the Worksheet related to the specified Project from a template. |
setup_worksheet |
Setup a new worksheet for a 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
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_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
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. |