How to Mail Merge from Google Sheets to Google Docs: One Letter per Row in a Single Doc (2026)

A mail merge takes one template and fills it with each row of a list: one letter, certificate or notice per person. Google Sheets holds the list well, but Google Docs has no command that fills a document from sheet rows. Gmail has a mail merge, but it sends emails and is only on some Workspace plans. This guide shows what the built-in option covers, then a short Apps Script that merges every row into one Google Doc, with each row on its own page, ready to print or save as a PDF. The examples use three fictional people.

The short answer

What’s built in: mail merge in Gmail

Google’s Gmail mail merge help page says that to use it you sign in with an eligible Google Workspace plan: Workspace Individual, Business Standard, Business Plus, Enterprise Standard, Enterprise Plus, Education Standard or Education Plus. Business Starter and personal Gmail accounts aren’t on that list.

On an eligible account, click Compose, then Use mail merge on the right of the “To:” line, turn on Mail Merge and click Add from a spreadsheet. Select the sheet, click Insert, choose the Email and First name columns (Last name is optional) and click Finish. Then type @ in the message to insert a merge tag. Merge tags come from your column headers. Google’s notes for the sheet: the contacts must be on the first tab and can only contain text. A message can go to up to 1,500 recipients, with up to 1,500 a day, and merge tags don’t work in subject lines.

This sends emails. It doesn’t create Docs or PDFs. For letters to print, certificates or one document for the whole list, use the script below. To email each person their own PDF, see email each row’s PDF as an attachment.

Google Docs itself has two features that sound close but don’t merge sheet rows. The email draft building block (Insert › Building blocks › Email draft) is one email you preview in Gmail. Variable chips (Insert › Smart chips › Variables, eligible work or school accounts only) are values you type into the Doc yourself.

Step 1: the sheet

Put the headers in row 1 and one person per row. Row 4 is left blank on purpose, to show that the script skips empty rows:

ABCD
1NameEventDateAmount ($)
2Avery StoneSpring Workshop3/14/2027$120.00
3Jordan LeeSpring Workshop3/14/2027$95.50
4
5Priya NairPottery Basics4/2/2027$1,250.00

Type the dates and amounts as plain values (3/14/2027, 120), then select C2:C5 and choose Format › Number › Date, and select D2:D5 and choose Format › Number › Currency. The cells then read exactly as in the table above, and that text is what lands in the Doc.

Step 2: the template Doc

Create a new Google Doc and type the letter. Wherever a value should go, type the column header in double braces, exactly as it appears in row 1:

Dear {{Name}},

Thank you for registering for {{Event}} on {{Date}}.

• Balance due: {{Amount ($)}}

See you there!

Make the balance line a bulleted line. You can add a table too. For example, a two-column table with “Event” | {{Event}} and “Date” | {{Date}} is filled in the same way. Copy the template’s ID from its URL, the part between /d/ and /edit.

Step 3: the script

In the sheet, open Extensions › Apps Script. Delete the sample code, paste this script and replace PASTE_TEMPLATE_DOC_ID with your template’s ID:

/**
 * Mail merge from Google Sheets to Google Docs: one Doc, one page per row.
 * Row 1 of the sheet = headers. The template Doc uses {{Header}} placeholders.
 */
const TEMPLATE_ID = 'PASTE_TEMPLATE_DOC_ID';

function mailMerge() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const data = sheet.getDataRange().getDisplayValues(); // values as shown in the sheet
  const headers = data[0];
  const template = DocumentApp.openById(TEMPLATE_ID).getBody();
  const doc = DocumentApp.create('Mail merge - ' + sheet.getName());
  const body = doc.getBody();
  let merged = 0;

  for (let r = 1; r < data.length; r++) {
    const row = data[r];
    if (row.every(v => v === '')) continue;            // skip blank rows
    if (merged > 0) body.appendPageBreak();            // each row starts a new page
    for (let i = 0; i < template.getNumChildren(); i++) {
      const el = template.getChild(i);
      const type = el.getType();
      let added;
      if (type === DocumentApp.ElementType.PARAGRAPH) added = body.appendParagraph(el.asParagraph().copy());
      else if (type === DocumentApp.ElementType.LIST_ITEM) {
        added = body.appendListItem(el.asListItem().copy());
        added.setGlyphType(el.asListItem().getGlyphType()); // keep the bullet style
      }
      else if (type === DocumentApp.ElementType.TABLE) added = body.appendTable(el.asTable().copy());
      else continue;                                    // other element types are not copied
      headers.forEach((h, c) => {
        if (h) added.replaceText('\\{\\{' + escapeRegex(h) + '\\}\\}', row[c]);
      });
    }
    merged++;
  }
  if (merged === 0) throw new Error('No data rows found below the header row.');
  body.getChild(0).removeFromParent();                 // the new Doc starts with one empty paragraph
  const url = doc.getUrl();
  doc.saveAndClose();
  Logger.log(merged + ' rows merged: ' + url);
}

// Headers such as "Amount ($)" contain regex characters; escape them for replaceText.
function escapeRegex(s) {
  return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}

What it does: it reads every row as displayed, skips blank rows, and for each row copies the template’s paragraphs, bullet points and tables into a new Doc. It replaces every {{Header}} with that row’s value and starts each row on a new page.

Step 4: limit the permissions

Apps Script picks scopes by scanning the code, and Google notes that it sometimes picks broader ones than a script needs. You can set them yourself. Click Project Settings on the left, tick Show “appsscript.json” manifest file in editor, go back to Editor, open appsscript.json and add the oauthScopes list. Keep your own timeZone value:

{
  "timeZone": "America/New_York",
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "oauthScopes": [
    "https://www.googleapis.com/auth/documents",
    "https://www.googleapis.com/auth/spreadsheets.currentonly"
  ]
}

Why these two: Google’s reference lists the documents scope for DocumentApp.openById and DocumentApp.create, and spreadsheets.currentonly covers reading the sheet the script is attached to. The script doesn’t use DriveApp, so it needs no Drive scope. A script that copies the template with DriveApp’s makeCopy needs the full drive scope, which per Google’s scope list lets it “see, edit, create, and delete all of your Google Drive files”. The documents scope is still broad for Docs: Google describes it as “See, edit, create, and delete all your Google Docs documents”. DocumentApp.openById has no narrower option, but the scope doesn’t reach your other Drive files.

Step 5: run it

Save, pick mailMerge in the function list at the top and click Run. The first time, Google asks you to authorize the script: review the two permissions it lists and allow them. When the run finishes, the execution log shows 3 rows merged: followed by the link to a new Doc named “Mail merge - Sheet1” in your Drive.

The new Doc has three pages: Avery Stone with $120.00, Jordan Lee with $95.50 and Priya Nair with $1,250.00, each with its date as 3/14/2027 or 4/2/2027 and the table filled in. The blank row 4 gets no page. Your template stays unchanged, so you can run again after editing the sheet. Each run makes a new Doc.

Step 6: print it or save it as a PDF

Open the merged Doc and scroll through the pages. To get a PDF, use File › Download and pick PDF as the file type, as described on Google’s download help page. To print, use File › Print.

Common problems

Want one Doc or PDF per row instead, without a script? SheetWeave (disclosure: we make it) is a Google Sheets add-on that fills your Google Docs template with each row’s data and saves it as a Doc or PDF in your Drive. It writes each file’s link back to its row and can run on only the new rows, so nothing is generated twice. It asks only for the spreadsheet you have open and the Drive files you choose or it creates. It makes one file per row, not one combined Doc like the script above. There is a 14-day free trial with no credit card to start. It is live on the Google Workspace Marketplace.
Install from Google Workspace MarketplaceSee SheetWeave

FAQ

Can you mail merge from Google Sheets to Google Docs?

Yes, but not with a built-in command. Google’s Help pages describe mail merge in Gmail for eligible Google Workspace plans, which sends emails rather than creating a Doc. To fill a Google Docs template from sheet rows, use a short Apps Script like the one on this page or an add-on.

Does Gmail have a built-in mail merge?

Yes, for eligible Google Workspace plans. Google lists Workspace Individual, Business Standard, Business Plus, Enterprise Standard, Enterprise Plus, Education Standard and Education Plus. It sends a personal copy of an email to each recipient, up to 1,500 recipients a day, and can read recipients from a Google Sheet. Personal Gmail accounts are not on Google’s list.

How many documents can an Apps Script create per day?

Google’s Apps Script quotas page lists 250 documents created per day for consumer accounts such as gmail.com and 1,500 per day for Google Workspace accounts, with each run limited to 6 minutes. The script on this page creates one Doc per run, however many rows you merge.

Why does my date or price look different in the merged Doc?

If a script reads cells with getValues, dates come back as date values instead of the text you see. The script on this page uses getDisplayValues, which Google says returns the displayed values with date, time and currency formatting applied. Format the cells in the sheet first and the Doc shows the same text, such as 3/14/2027 and $1,250.00.

Which permissions does the script ask for?

With the manifest on this page, two. The documents scope, which Google describes as “See, edit, create, and delete all your Google Docs documents”, is needed to open the template and create the merged Doc. The spreadsheets.currentonly scope covers the spreadsheet the script is attached to. It does not ask for access to your other Google Drive files, because it does not use DriveApp.

Related guides

Instructions refer to Google Sheets, Google Docs and Gmail as they worked on November 30, 2026. Not affiliated with Google. Google Sheets, Google Docs, Gmail and Google Drive are trademarks of Google LLC. All names in the examples are fictional. Questions or corrections: hello@loomwise.app.