Skip to content
Mog is in active development. The GitHub repo, SDK packages, and community channels are not yet available. Follow for launch updates

wb.scenarios

WorkbookScenarios

6 methods

create

Promise<string>
create(config: ScenarioConfig): Promise<string>;
ParameterTypeRequired
configScenarioConfigrequired

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>;
ParameterTypeRequired
idstringrequired

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>;
ParameterTypeRequired
originalValuesOriginalCellValue[]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>;
ParameterTypeRequired
scenarioIdstringrequired
configPartial<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>;
ParameterTypeRequired
idstringrequired

Delete a scenario. @param id - The scenario ID to delete.