Email from google sheets
You want to send an email from Google Sheets! That's a great idea. Here's a step-by-step guide on how to do it:
Method 1: Using the "Mail" function
- Open your Google Sheet and select the cell where you want to send the email.
- Type
=mail("[email protected]", "Subject", "Body")
(without quotes) in the cell. - Replace
"[email protected]"
with the recipient's email address. - Replace
"Subject"
with the subject of the email. - Replace
"Body"
with the body of the email. - Press Enter to send the email.
Method 2: Using the "Script" feature
- Open your Google Sheet and go to Tools > Script editor.
- Delete any existing code in the editor and paste the following script:
function sendEmail() { var sheet = SpreadsheetApp.getActiveSheet(); var recipient = sheet.getRange("A1").getValue(); // Replace A1 with the cell containing the recipient's email var subject = sheet.getRange("A2").getValue(); // Replace A2 with the cell containing the subject var body = sheet.getRange("A3").getValue(); // Replace A3 with the cell containing the body MailApp.sendEmail(recipient, subject, body); }
- Save the script by clicking the floppy disk icon or pressing Ctrl+S (or Cmd+S on a Mac).
- Go back to your Google Sheet and click on the "Run" button (or press Ctrl+Enter or Cmd+Enter) to execute the script.
- The script will send an email to the recipient with the subject and body specified in the cells.
Tips and Variations
- You can customize the script to send emails to multiple recipients by modifying the
recipient
variable to an array of email addresses. - You can also add attachments to the email by using the
addAttachment()
method. - If you want to send emails in bulk, you can use the
getRange()
method to select multiple cells and then loop through them to send emails to each recipient.