I want to restrict delete worksheet option from worksheet tab.
I couldn’t find any thing about this so that I use one event which is available in office-js documentation. onDeleted
For that I use this code snippet.
await Excel.run(async (context) => {
const sheets = context.workbook.worksheets;
sheetDelete = sheets.onDeleted.add(onSheetDeleted);
await context.sync();
});
But this event trigger after deletion of worksheet. Based on my requirement I want to restrict this for some user.
So is there any way I can retrieve last deleted worksheet in this event Or Is there other event which is trigger before deletion of any worksheet so that I use that event so worksheet will not be delete.