Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the following method to send an email via Google Apps Script through a Google Spreadsheet:

  1. Open your Google Spreadsheet and go to Tools > Script editor.
  2. In the script editor, write the following code to send an email:

    function sendEmail() { var recipient = "email@example.com"; var subject = "Test Email"; var body = "This is a test email."; MailApp.sendEmail(recipient, subject, body); }

    Make sure to replace the example email address with the actual email address you want to send the email to.

  3. Save the script and then go back to your spreadsheet.

  4. In the spreadsheet, go to Tools > Macros > sendEmail.
  5. When you run the macro, it will send the email to the recipient you specified in the script.

Note: Before you can send emails using Google Apps Script, you need to grant permission for the script to access your Gmail account.