I am testing out array handling with checkboxes and have the following code:
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
function arrayTest() {
var bigArray = sheet.getRange(1,1,5,3).getValues();
bigArray[2][1] = false;
sheet.getRange(1,1,5,3).setValues(bigArray);
}
My sheet looks like this:
The TEST button is assigned to my arrayTest function. When I run it in the IDE, it runs fine. When I click the button on the sheet to run the same code, I get TypeError: Cannot read properties of null (reading 'getRow'). This error message points to a random function elsewhere in the code base, but there's no reason that I can see that that function would be called.
Why do I get a TypeError executing from the sheet?
UPDATE: I created a new project, re-created the sheet and copied in the code, and it worked fine from the button. I don't understand why it was calling a random function, however.
