Excel.TableChangedEventArgs interface
Provides information about the table that raised the changed event.
Remarks
Properties
address | Gets the address that represents the changed area of a table on a specific worksheet. |
change |
Gets the change type that represents how the changed event is triggered. See |
details | Gets 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 |
table |
Gets the ID of the table in which the data changed. |
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 table on a specific worksheet. |
get |
Gets the range that represents the changed area of a table on a specific worksheet. It might return null object. |
Property Details
address
Gets the address that represents the changed area of a table on 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
Gets 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
// 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) {
await Excel.run(async (context) => {
const details = eventArgs.details;
const address = eventArgs.address;
console.log(`Change at ${address}: was ${details.valueBefore}(${details.valueTypeBefore}),`
+ ` now is ${details.valueAfter}(${details.valueTypeAfter})`);
});
}
source
Gets the source of the event. See Excel.EventSource
for details.
source: Excel.EventSource | "Local" | "Remote";
Property Value
Excel.EventSource | "Local" | "Remote"
Remarks
tableId
Gets the ID of the table in which the data changed.
tableId: string;
Property Value
string
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/events-tablecollection-changed.yaml
async function onChange(event) {
await Excel.run(async (context) => {
let table = context.workbook.tables.getItem(event.tableId);
let worksheet = context.workbook.worksheets.getItem(event.worksheetId);
worksheet.load("name");
await context.sync();
console.log("Handler for table collection onChanged event has been triggered. Data changed address: " + event.address);
console.log("Table Id : " + event.tableId);
console.log("Worksheet Id : " + worksheet.name);
});
}
type
Gets the type of the event. See Excel.EventType
for details.
type: "TableChanged";
Property Value
"TableChanged"
Remarks
worksheetId
Gets the ID of the worksheet in which the data changed.
worksheetId: string;
Property Value
string
Remarks
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/events-tablecollection-changed.yaml
async function onChange(event) {
await Excel.run(async (context) => {
let table = context.workbook.tables.getItem(event.tableId);
let worksheet = context.workbook.worksheets.getItem(event.worksheetId);
worksheet.load("name");
await context.sync();
console.log("Handler for table collection onChanged event has been triggered. Data changed address: " + event.address);
console.log("Table Id : " + event.tableId);
console.log("Worksheet Id : " + worksheet.name);
});
}
Method Details
getRange(ctx)
Gets the range that represents the changed area of a table on a specific worksheet.
getRange(ctx: Excel.RequestContext): Excel.Range;
Parameters
Returns
getRangeOrNullObject(ctx)
Gets the range that represents the changed area of a table on a specific worksheet. It might return null object.
getRangeOrNullObject(ctx: Excel.RequestContext): Excel.Range;
Parameters
Returns
Office Add-ins