Edit

Excel.ChangedEventDetail interface

Provides information about the details of a WorksheetChangedEvent or TableChangedEvent.

Remarks

API set: ExcelApi 1.9

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/data-change-event-details.yaml

async function onTableChanged(eventArgs: Excel.TableChangedEventArgs) {
    // Inspect the values and basic types of an edited table cell, and identify errors.
    await Excel.run(async (context) => {
        const details: Excel.ChangedEventDetail = eventArgs.details;
        const address = eventArgs.address;
        if (!details) {
            console.log("Edit one table cell at a time to inspect its value and type.");
            return;
        }

        console.log(`Change at ${address}: was ${details.valueBefore}(${details.valueTypeBefore}),`
          + ` now is ${details.valueAfter}(${details.valueTypeAfter})`);

        const errorType: Excel.RangeValueType = Excel.RangeValueType.error;
        if (details.valueTypeAfter === errorType) {
            console.log("The updated cell contains an error:", details.valueAfter);
        }
    });
}

Properties

valueAfter

Represents the value after the change. The data returned could be a string, number, or Boolean. Cells that contain an error will return the error string.

valueBefore

Represents the value before the change. The data returned could be a string, number, or Boolean. Cells that contain an error will return the error string.

valueTypeAfter

Represents the type of value after the change.

valueTypeBefore

Represents the type of value before the change.

Property Details

valueAfter

Represents the value after the change. The data returned could be a string, number, or Boolean. Cells that contain an error will return the error string.

valueAfter: any;

Property Value

any

Remarks

API set: ExcelApi 1.9

valueBefore

Represents the value before the change. The data returned could be a string, number, or Boolean. Cells that contain an error will return the error string.

valueBefore: any;

Property Value

any

Remarks

API set: ExcelApi 1.9

valueTypeAfter

Represents the type of value after the change.

valueTypeAfter: Excel.RangeValueType | "Unknown" | "Empty" | "String" | "Integer" | "Double" | "Boolean" | "Error" | "RichValue";

Property Value

Excel.RangeValueType | "Unknown" | "Empty" | "String" | "Integer" | "Double" | "Boolean" | "Error" | "RichValue"

Remarks

API set: ExcelApi 1.9

valueTypeBefore

Represents the type of value before the change.

valueTypeBefore: Excel.RangeValueType | "Unknown" | "Empty" | "String" | "Integer" | "Double" | "Boolean" | "Error" | "RichValue";

Property Value

Excel.RangeValueType | "Unknown" | "Empty" | "String" | "Integer" | "Double" | "Boolean" | "Error" | "RichValue"

Remarks

API set: ExcelApi 1.9