// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/events-disable-events.yaml
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
const sumRange = sheet.getRange("B20:P20");
sumRange.load("columnCount");
await context.sync();
// add an event handler to each cell in the sum range
for (let i = 0; i < sumRange.columnCount; i++) {
let sumBinding = context.workbook.bindings.add(sumRange.getCell(0,i), Excel.BindingType.range, "SumBinding" + i);
sumBinding.onDataChanged.add(onSumChanged);
}
await context.sync();
});
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.