MAILMERGEGENERATOR

Generate a ready-to-use Google Apps Script for mail merge directly from your browser. No add-ons required.

Free to use
No account needed
Works in your browser

Why Mail Merge Script Generator?

No Add-ons Required

Generate vanilla Google Apps Script that you own. Run it directly from your own Google account.

Use Custom Merge Fields

Personalize your emails with any column from your spreadsheet using {{Column Name}} syntax.

100% Privacy

This tool runs completely in your browser. We never see your spreadsheet data, emails, or templates.

Premium Tools

Go further with Pro

These Google Workspace add-ons install in seconds and automate workflows you're still doing manually.

Coming Soon

Intelligent AutoCrat

AI-Native Form → Document Workflow Addon. Turn Google Forms submissions into customized, contextually appropriate documents generated by AI.

Learn more
Coming Soon

Semantic Sheets

AI Sheet Data Intelligence Addon. Bring semantic understanding to Google Sheets to instantly clean, classify, and extract unstructured data.

Learn more
Coming Soon

TalentDesk

Your hiring desk, inside Google Sheets. An AI-powered hiring workflow system that automates candidate evaluation, resume scoring, and interview preparation.

Learn more
Newsletter

Stay ahead of the curve

Get notified when new free tools launch and receive practical Google Workspace automation tips straight to your inbox.

Free updates. No spam. Unsubscribe any time.

How it works

Why this tool exists

You want to send personalized emails from Google Sheets, but don't want to pay for expensive mail merge add-ons like YAMM just to run a simple script. Plus, you want full control over your data.

Most mail merge add-ons cost a monthly fee and require extensive permissions to read your emails and spreadsheets. By using a custom Apps Script, the code lives entirely in your Google account. Here is how to use it:

  1. Prepare your data: Ensure your Google Sheet has a header row with columns like First Name or Email Address.
  2. Draft your template: Fill out the form here with your desired subject and body using {{Column Header}} to inject custom data.
  3. Copy the script: Click "Copy Code" to get your personalized Mail Merge script.
  4. Install in Sheets: Open your Google Sheet, click Extensions > Apps Script, paste the code, and hit Save.
  5. Send: Refresh your spreadsheet to see a new custom Mail Merge menu at the top. Click it to send!

Need a more powerful version?

Explore Pro tools
Mail Merge Script Generator — Free ToolFree

The exact name of the column containing recipient emails.

function sendMailMerge() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  const data = sheet.getDataRange().getValues();
  
  if (data.length < 2) {
    SpreadsheetApp.getUi().alert("Not enough data in the sheet.");
    return;
  }
  
  const headers = data[0];
  const emailColIndex = headers.indexOf("Email Address");
  
  if (emailColIndex === -1) {
    SpreadsheetApp.getUi().alert("Could not find column named 'Email Address'. Please check your headers.");
    return;
  }
  
  const templateSubject = "Update for {{First Name}}";
  const templateBody = `Hi {{First Name}},\n\nHere is your custom link: {{Custom Link}}\n\nBest,\nTeam`;
  
  let emailsSent = 0;
  
  for (let i = 1; i < data.length; i++) {
    const row = data[i];
    const emailAddress = row[emailColIndex];
    
    if (!emailAddress || String(emailAddress).trim() === "") continue;
    
    let currentSubject = templateSubject;
    let currentBody = templateBody;
    
    // Replace all {{Header}} with actual row data
    for (let j = 0; j < headers.length; j++) {
      const header = headers[j];
      const value = row[j] || "";
      
      const regex = new RegExp("\\{\\{" + escapeRegExp(String(header)) + "\\}\\}", "gi");
      currentSubject = currentSubject.replace(regex, value);
      currentBody = currentBody.replace(regex, value);
    }
    
    try {
      MailApp.sendEmail({
        to: String(emailAddress),
        subject: currentSubject,
        body: currentBody
      });
      emailsSent++;
    } catch (e) {
      Logger.log("Failed to send to " + emailAddress + ": " + e.toString());
    }
  }
  
  SpreadsheetApp.getUi().alert("Successfully sent " + emailsSent + " emails!");
}

function escapeRegExp(string) {
  return string.replace(/[.*+?^$\{\}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

function onOpen() {
  SpreadsheetApp.getUi().createMenu('Mail Merge')
      .addItem('Send Emails', 'sendMailMerge')
      .addToUi();
}
Newsletter

Get every new tool on launch day

We ship one or two free tools every week. Subscribe and be the first to use them.

Free updates. No spam. Unsubscribe any time.

Related Tools

You might also like

More Google Workspace tools built to save you hours every single week.

Live

Email List Cleaner

Paste any messy text and instantly extract, deduplicate, and validate a clean list of emails.

Learn more
Coming Soon

Intelligent AutoCrat

AI-Native Form → Document Workflow Addon. Turn Google Forms submissions into customized, contextually appropriate documents generated by AI.

Learn more
Coming Soon

Semantic Sheets

AI Sheet Data Intelligence Addon. Bring semantic understanding to Google Sheets to instantly clean, classify, and extract unstructured data.

Learn more