Excel.WorksheetAddedEventArgs interface

Provides information about the worksheet that raised the added event.

Remarks

[ API set: ExcelApi 1.7 ]

Properties

source

Gets the source of the event. See Excel.EventSource for details.

type

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

worksheetId

Gets the ID of the worksheet that is added to the workbook.

Property Details

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 ]

type

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

type: "WorksheetAdded";

Property Value

"WorksheetAdded"

Remarks

[ API set: ExcelApi 1.7 ]

worksheetId

Gets the ID of the worksheet that is added to the workbook.

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-workbook-and-worksheet-collection.yaml

async function onWorksheetAdd(event) {
    await Excel.run(async (context) => {
        console.log(
            "Handler for worksheet onAdded event has been triggered. Newly added worksheet Id : " +
            event.worksheetId
        );
    });
}