My question relates to this question Excel Online Javascript Api Add Allow Edit Range
The issue was caused by the allowed edit range already existing but I’m unsure of the Excel Js Syntax to delete the pre existing range. The delete method listed here https://learn.microsoft.com/en-us/javascript/api/excel/excel.alloweditrange?view=excel-js-preview but very few code examples to follow. Can anyone help?
worksheet = context.workbook.worksheets.getItem(worksheetName);
worksheet.load(["protection/protected", "protection/alloweditranges", "protection/alloweditranges/items"]);
await context.sync();
worksheet.protection.allowEditRanges.delete("rng1", "A4:G500");
worksheet.protection.allowEditRanges.delete("rng2", "I4:L500");