Basic Mail Merge from a Google Doc and Sheet
- Add this script to a Google Doc, then re-load the document. You should see a new menu item called "Email".
- Write the template email, using {{variable1}}, {{variable2}}, etc. for the variables you want to replace.
- Click "Create Spreadsheet" in the Email menu. This will create a new spreadsheet in your Google Drive.
- Populate the fields of the Spreadsheet with the values you want to replace in the template email.
- Open the Email menu of the Google Doc, and choose Create Drafts/Create Single Draft to confirm that the script is working.
- Send the Drafts (or uncomment the "Send Email" option in onOpen() to send add a button in the Email menu to send immediately).