Edit

Share via


Excel.WorksheetCalculatedEventArgs interface

Provides information about the worksheet that raised the calculated event.

Remarks

[ API set: ExcelApi 1.8 ]

Examples

async function registerOnCalculatedHandler() {
    await Excel.run(async (context) => {
        let sheet = context.workbook.worksheets.getItem("Sample");
        sheet.onCalculated.add(onCalculated);
        await context.sync();
    });
}

async function onCalculated(event: Excel.WorksheetCalculatedEventArgs) {
    await Excel.run(async (context) => {
        // `event.address` returns the address of the range that completed calculation.
        // If multiple ranges completed calculation, the string is a comma-separated list of those range addresses.
        console.log(`The Range ${event.address} has recalculated.`);
    });
}

Properties

address

The address of the range that completed calculation. If multiple ranges completed calculation, the string is a comma-separated list of those range addresses.

type

Gets the type of the event. See Excel.EventType for details.

worksheetId

Gets the ID of the worksheet in which the calculation occurred.

Property Details

address

The address of the range that completed calculation. If multiple ranges completed calculation, the string is a comma-separated list of those range addresses.

address: string;

Property Value

string

Remarks

[ API set: ExcelApi 1.11 ]

type

Gets the type of the event. See Excel.EventType for details.

type: "WorksheetCalculated";

Property Value

"WorksheetCalculated"

Remarks

[ API set: ExcelApi 1.8 ]

worksheetId

Gets the ID of the worksheet in which the calculation occurred.

worksheetId: string;

Property Value

string

Remarks

[ API set: ExcelApi 1.8 ]