Excel.ChangedEventDetail interface
Provides information about the details of a WorksheetChangedEvent or TableChangedEvent.
Remarks
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
| value |
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. |
| value |
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. |
| value |
Represents the type of value after the change. |
| value |
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
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
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
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"