Excel.WorksheetChangedEventArgs interface
Provides information about the worksheet that raised the changed event.
Remarks
Properties
address | Gets the range address that represents the changed area of a specific worksheet. |
change |
Gets the change type that represents how the changed event is triggered. See |
details | Represents the information about the change detail. This property can be retrieved when the changed event is triggered on a single cell. If the changed event is triggered on multiple cells, this property cannot be retrieved. |
source | Gets the source of the event. See |
type | Gets the type of the event. See |
worksheet |
Gets the ID of the worksheet in which the data changed. |
Methods
get |
Gets the range that represents the changed area of a specific worksheet. |
get |
Gets the range that represents the changed area of a specific worksheet. It might return null object. |
Property Details
address
Gets the range address that represents the changed area of a specific worksheet.
address: string;
Property Value
string
Remarks
changeType
Gets the change type that represents how the changed event is triggered. See Excel.DataChangeType
for details.
changeType: Excel.DataChangeType | "Unknown" | "RangeEdited" | "RowInserted" | "RowDeleted" | "ColumnInserted" | "ColumnDeleted" | "CellInserted" | "CellDeleted";
Property Value
Excel.DataChangeType | "Unknown" | "RangeEdited" | "RowInserted" | "RowDeleted" | "ColumnInserted" | "ColumnDeleted" | "CellInserted" | "CellDeleted"
Remarks
details
Represents the information about the change detail. This property can be retrieved when the changed event is triggered on a single cell. If the changed event is triggered on multiple cells, this property cannot be retrieved.
details: Excel.ChangedEventDetail;
Property Value
Remarks
Examples
// This function would be used as an event handler for the Worksheet.onChanged event.
async function onWorksheetChanged(eventArgs) {
await Excel.run(async (context) => {
const details = eventArgs.details;
const address = eventArgs.address;
// Print the before and after types and values to the console.
console.log(`Change at ${address}: was ${details.valueBefore}(${details.valueTypeBefore}),`
+ ` now is ${details.valueAfter}(${details.valueTypeAfter})`);
await context.sync();
});
}
source
Gets the source of the event. See Excel.EventSource
for details.
source: Excel.EventSource | "Local" | "Remote";
Property Value
Excel.EventSource | "Local" | "Remote"
Remarks
type
Gets the type of the event. See Excel.EventType
for details.
type: "WorksheetChanged";
Property Value
"WorksheetChanged"
Remarks
worksheetId
Gets the ID of the worksheet in which the data changed.
worksheetId: string;
Property Value
string
Remarks
Method Details
getRange(ctx)
Gets the range that represents the changed area of a specific worksheet.
getRange(ctx: Excel.RequestContext): Excel.Range;
Parameters
Returns
getRangeOrNullObject(ctx)
Gets the range that represents the changed area of a specific worksheet. It might return null object.
getRangeOrNullObject(ctx: Excel.RequestContext): Excel.Range;
Parameters
Returns
Office Add-ins