Can you change the from email in google mail merge

In Google Sheets, you can change the "From" email address in a Mail Merge using the setFrom method. Here's an example:

Assuming you have a sheet named "Mailing List" with a column named "Email" and a column named "Name", and you want to send an email to each person in the list using a Mail Merge:

  1. Go to the "Tools" menu in Google Sheets and select "Mail Merge".
  2. In the Mail Merge window, select the sheet and range you want to use for the merge.
  3. In the "From" field, enter the email address you want to use as the sender. You can also use a formula to dynamically generate the email address, such as =A2 if the email address is in column A.
  4. Click "Merge" to send the emails.

Alternatively, you can also use the setFrom method in the Mail Merge script editor. To do this:

  1. Go to the "Tools" menu in Google Sheets and select "Script editor".
  2. In the script editor, click on the "Mail Merge" tab.
  3. In the "Mail Merge" tab, click on the "Set from" button.
  4. In the "Set from" dialog box, enter the email address you want to use as the sender.
  5. Click "OK" to save the changes.

Here's an example of how you can use the setFrom method in your script:

function mailMerge() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var range = sheet.getRange("A1:B10"); // Assuming the email addresses are in column A
  var fromEmail = "[email protected]"; // Replace with the email address you want to use as the sender

  MailApp.setFrom(fromEmail);
  MailApp.sendEmails(range, "Subject", "Body");
}

Note that you need to replace [email protected] with the actual email address you want to use as the sender.