Guide

Mail merge to PDF with Google Docs and Apps Script

Updated

For a job that repeats, Google Docs with Apps Script is the better route.

Want the script written for you?

2 minutes

Want somebody to build the pipeline?

Tell us the volume and what has to come out the other end. Up to three document and data extraction software suppliers will contact you directly.

Next: where to reach you.

  • Free, no obligation
  • We never ask you to upload a document here
  • No marketing lists, ever
  • Free to use
  • No account needed
  • Steps from each maker's own guides
  • Suppliers only if you ask
  • Your details go to up to three document software suppliers, and no one else.
  • No spam, ever. Privacy notice

Most people arrive here after failing at Word. For a recurring job this route is the better answer, not the consolation prize.

Question 1

What do you need out of it?

This is the decision that separates a five minute job from a scripting project, and it is worth being precise about before you start.

The shape

A template document containing placeholder text. A spreadsheet holding one row per record. A script that, for each row, copies the template and replaces the placeholders with the row's values. It exports the copy as a PDF, saves it under a name built from the row, and optionally emails it.

Google's Apps Script documentation for Docs covers the document manipulation. The important structural point is that exporting as PDF and writing a named file are both ordinary operations here, which is exactly what Word is missing.

Test on three rows

A script that produces the wrong output produces a great deal of it very quickly, and cleaning up three thousand wrong files is worse than producing them.

Point it at a three-row copy of the sheet first, open all three, then run the real thing.

Batches and time limits

Long runs hit execution time limits. Write the script to process a batch and record where it stopped, so a partial run resumes rather than restarts.

That also makes a failure recoverable at three in the morning, which matters once the job is on a schedule.

Delete the intermediate copies

The natural implementation copies the template, edits the copy, exports it and moves on, leaving one document per record behind alongside every PDF.

Delete them in the loop. A tidy-up job afterwards is a job somebody has to remember, and nobody does.

Why it wins for recurring work

It runs unattended on a trigger. No desktop merge does, and that is the difference between a task somebody performs monthly and a process that happens.

It also removes the operating system question entirely, which is the practical reason it is often the right answer for anybody on a Mac.

Sources

This site's own dataset, every figure quoted from its source and dated:

  • The Merge to PDF Tool Index carries 31 published figures read from 27 sources' own pages; the 29 published figures given without a breakdown run from 8.99 to 199 USD, read November 11, 2026.
  1. Microsoft, use mail merge for bulk email, letters, labels and envelopes
  2. Microsoft, mail merge using an Excel spreadsheet
  3. Google, Apps Script guide to Google Docs
  4. Section508.gov, creating accessible PDFs
  5. Section508.gov, laws and policies

Find the route before you open Word

What has to come out, and what you are working with. Two answers and the method is decided.