0

I'm currently working on Angular Based Office Add-in for Excel where data tables are moved in and out of a server. Based on the microsoft documentation, I'm using the shown method for tracking changes in a given worksheet for any type of change however when a row is deleted, it notices that a delete event has occurred but it does not have the value of the row that was deleted. I am able to capture the data when individual cells are modified or added or even deleted using backspace. However, when a range of data has been changed, the event is not able to capture the data that was changed.

The goal is to capture the data that was edited/added/deleted from the excel tables but I am unable to do so when the event occurs over a range. Is there another function that can track changes over a range of data?

async trackSheetData(worksheetName: string) {
    await Excel.run(async (context) => {
        let sheet = context.workbook.worksheets.getItem(worksheetName);
        sheet.onChanged.add(this.handleChange);
    });
}

//function to handle changes
async handleChange(event) {
    await Excel.run(async (context) => {
        let activeSheet = context.workbook.worksheets.getActiveWorksheet();
        activeSheet.load("name");
        await context.sync();
        console.log("Change type of event: " + event.changeType);
        console.log("Address of event: " + event.address);
        console.log("Sheet change occured on: " + activeSheet.name);
        console.log(event);
    }).catch((err) => console.log(err));
}

Cases:

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45

1 Answers1

0

Currently, the feature you want may not supported in WorksheetChangedEvent. And there doesn't seem to be any other way to achieve this. "Detail" property can only be retrieved if the changed event is triggered on a single cell. You can add your request here: Microsoft 365 Developer Platform Ideas Forum.

SiruiMSFT
  • 46
  • 1