TypeError: ss.getSheetByname is not a function

412 views
Skip to first unread message

Adrien Blanchot

unread,
Jan 31, 2022, 3:46:43 PM1/31/22
to Google Apps Script Community
Helllo here.

I have one script for Mailsending autmatic

But i have one error.


function myFunction() {
  // définir les variables
  var ss = SpreadsheetApp.getActiveSpreadsheet()
  var sheet1=ss .getSheetByname('Commandes');
  var emailaddress = sheet1.getrange(5,6).getValue();
  var subject = sheet1.getrange(5,7).getValue();
  var message = sheet1.getrange(5,8).getValue();

  // Envoyer le mail

  MailApp.sendEmail(emailaddress,subject,message)

21:20:25
Erreur
TypeError: ss.getSheetByname is not a function
myFunction
@ Sans titre.gs:4
Need Help pls

Alan Wells

unread,
Jan 31, 2022, 3:48:35 PM1/31/22
to Google Apps Script Community
Try using a capital letter "N" for Name.
getSheetByName
I'm guessing that's the problem.

Adrien Blanchot

unread,
Feb 1, 2022, 10:40:24 AM2/1/22
to Google Apps Script Community
Yeah ! It's that ! Thanks You ! 
 But I will have another request ^^

I just discovered the scripts.

And I try to automate the mail sending.

How can I do to send a mail for each line? 

Flores Pablo Maria Sanguinetti

unread,
Feb 1, 2022, 11:04:29 AM2/1/22
to google-apps-sc...@googlegroups.com
Hi Adrien Blanchot  ;

For  sent mail ,you need declarate Const and Var of each row .Later declarate the cycle for to send the mail for row.
If you need help ,talk me .I develop un send mail for row and for all rows .
See you  

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/99166e82-a874-428b-9080-b3a65937c506n%40googlegroups.com.

Adrien Blanchot

unread,
Feb 1, 2022, 11:17:29 AM2/1/22
to Google Apps Script Community
Hello,

Thank you for your answer.

I would be very interested in your system

Flores Pablo Mari Sanguinetti

Lokesh DS

unread,
Feb 1, 2022, 12:38:33 PM2/1/22
to google-apps-sc...@googlegroups.com
Hi,

I have a doubt please help me out here.

Whenever I send mail using apps script the body of the mail breaks after every 80 characters and proceeds to a new line.

Please help me how to avoid the auto line break here.



--
Regards,
Lokesh
Reply all
Reply to author
Forward
0 new messages