How can you get script to look at a certain sheet in a spreadsheet? -



How can you get script to look at a certain sheet in a spreadsheet? -

i trying send emails spreadsheet. script grabs emails , body of email sheet within spreadsheet. when sheet first sheet, script works fine. however, reasons won't go need sheet first. have tried using:

var ss = spreadsheetapp.getactive.sheet();

var sheet = ss.getsheetbyname('email');

however, when message

typeerror: cannot find function getsheetbyname in object sheet. (line 3, file "code")

is there way script info sheet besides first sheet in spreadsheet?

to sheet in spreadsheet need utilize method belongs sheet parent's class, in other words, method spreadsheet class.

spreadsheet container of sheets, basic concept.

so utilize code below :

var ss = spreadsheetapp.getactivespreadsheet();// gets active spreadsheet in working var sheet = ss.getsheetbyname('emails');// if sheet want called 'emails

you avoid such simple problems making utilize of autocomplete feature included in script editor : type spread followed control space , you'll see available methods in context, first 1 spreadsheetapp, type dot (.) , see methods in class , type of object returns... take 1 need , go on al along.

see illustration below :

google-apps-script

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -