google apps script - Error encountered when accessing Spreadsheet via getActiveSheet() -- works correctly any other way -


i've been working set of scripts in google apps script (specifically on set of spreadsheets) on month now, , of sudden getting errors time try access sheet via spreadsheetapp.getactivesheet().

i assumed threw off in 1 of functions somewhere, until wrote test function didn't rely on of own code:

function basicfunctionality() {   var sheet = spreadsheetapp.getactivesheet();   var range = sheet.getrange('b2');   var vals = range.getvalues();   browser.msgbox(vals[0][0]); } 

running function returns error...

unknown sheet name (line 5) 

...which seem imply issue "getvalues" line, except when access sheet means other getactivespreadsheet() (e.g. getsheetbyname(), getsheets()[0]), function runs end , returns expected result.

now, i'm still assuming issue in code files, , not google bug -- i've run out of ideas. have tried copying script files new spreadsheet document/project -- test function works if it's thing port over, once rest of project gets in there, issue crops again (even if comment every other file out entirely, bizarre part).

is there way have conceivably "broken" getactivesheet()? or misidentifying problem?

thanks in advance insights!

your code works fine me. attached function drawing dropped spreadsheet, ran it, , returned data cell b2 in sheet.

could try again check it's still broken you?

is possible script running in context gas doesn't know active sheet is? when ran code in debugger seemed pick first sheet active sheet regardless of sheet had last had input.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -