wb.scenarios
WorkbookScenarios
6 methods
create
→ Promise<string>create(config: ScenarioConfig): Promise<string>;| Parameter | Type | Required |
|---|---|---|
| config | ScenarioConfig | required |
Create a what-if scenario. @param config - Scenario configuration (name, changing cells, values). @returns The newly created scenario's ID.
list
→ Promise<Scenario[]>list(): Promise<Scenario[]>;List all scenarios in the workbook. @returns Array of all saved scenarios.
apply
→ Promise<ApplyScenarioResult>apply(id: string): Promise<ApplyScenarioResult>;| Parameter | Type | Required |
|---|---|---|
| id | string | required |
Apply a scenario's values to the worksheet. @param id - The scenario ID to apply. @returns Result including cells updated count and original values for restore.
restore
→ Promise<void>restore(originalValues: OriginalCellValue[]): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| originalValues | OriginalCellValue[] | required |
Restore original values from a prior apply() call and deactivate the scenario. @param originalValues - The original cell values returned by apply().
update
→ Promise<void>update(scenarioId: string, config: Partial<ScenarioConfig>): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| scenarioId | string | required |
| config | Partial<ScenarioConfig> | required |
Update an existing scenario's configuration. @param scenarioId - The scenario ID to update. @param config - Partial configuration with fields to change.
delete
→ Promise<void>delete(id: string): Promise<void>;| Parameter | Type | Required |
|---|---|---|
| id | string | required |
Delete a scenario. @param id - The scenario ID to delete.