I have a Google Form which contains the following script. Each time it fails because SpreadsheetApp.getActive()
returns null. Any ideas as to why?
function onOpen(e) {
var courseSheet = SpreadsheetApp.getActive().getSheetByName("Courses");
}
The error I get is TypeError: Cannot call method "getSheetByName" of null. (line 6, file "")
I have found lots of examples online which shows usage in this way so I'm sure it's possible. Could it be a permissions issue with the spreadsheet that my form is linked to?