This code snippet I have been using to update cell A1 doesn't seem to be working:
function main(workbook: ExcelScript.Workbook) {
let worksheet = workbook.getWorksheet("Sheet1");
var i: number = 0;
while (true) {
worksheet.getRange("A1").setValue(i);
i = i + 1;
}
}
When I run the code, nothing happens.
However, if I add a seemingly irrelevant line like
console.log("abc")
at the end of the loop, as shown below:
function main(workbook: ExcelScript.Workbook) {
let worksheet = workbook.getWorksheet("Sheet1");
var i: number = 0;
while (true) {
worksheet.getRange("A1").setValue(i);
i = i + 1;
console.log("abc");
}
}
everything works perfectly fine.
What could possibly be causing this issue?