Excel.TableChangedEventArgs interface

Provides information about the table that raised the changed event.

Remarks

[ API set: ExcelApi 1.7 ]

Properties

address

Gets the address that represents the changed area of a table on a specific worksheet.

changeType

Gets the change type that represents how the changed event is triggered. See Excel.DataChangeType for details.

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 Excel.EventSource for details.

tableId

Gets the ID of the table in which the data changed.

type

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

worksheetId

Gets the ID of the worksheet in which the data changed.

Methods

getRange(ctx)

Gets the range that represents the changed area of a table on a specific worksheet.

[ API set: ExcelApi 1.8 ]

getRangeOrNullObject(ctx)

Gets the range that represents the changed area of a table on a specific worksheet. It might return null object.

[ API set: ExcelApi 1.8 ]

Property Details

address

Gets the address that represents the changed area of a table on a specific worksheet.

address: string;

Property Value

string

Remarks

[ API set: ExcelApi 1.7 ]

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

[ API set: ExcelApi 1.7 ]

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

[ API set: ExcelApi 1.9 ]

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

[ API set: ExcelApi 1.7 ]

tableId

Gets the ID of the table in which the data changed.

tableId: string;

Property Value

string

Remarks

[ API set: ExcelApi 1.7 ]

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

[ API set: ExcelApi 1.7 ]

worksheetId

Gets the ID of the worksheet in which the data changed.

worksheetId: string;

Property Value

string

Remarks

[ API set: ExcelApi 1.7 ]

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.

[ API set: ExcelApi 1.8 ]

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.

[ API set: ExcelApi 1.8 ]

getRangeOrNullObject(ctx: Excel.RequestContext): Excel.Range;

Parameters

Returns