I\'ve searched through the forums a few times and I wasn\'t able to suss out an answer to my issue.
I\'m using Google Sheets to track project progress for my team.
I think this will work for you,
var ss = SpreadsheetApp.getActiveSheet();
var s = ss.getActiveSheet();
var r = s.getActiveRange();
Let me know if it is working OR not.
I encountered some similar exception in my app script but in my case, there was a silly mistake, I forgot passing variable reference while calling the method
function validate(name) {
if (!codeConstants[name]) {
Logger.log('Error:' + name);
}
}
function init(name) {
if (!validate())
return;
// some code....
}
My validate method call had a trouble it should be changed to
if (!validate(name))
Looks that you are running the function from the Script Editor. In this case, event
is undefined. To learn about how to test a trigger function see How can I test a trigger function in GAS?