Skip to content
motifuse

How to mail-merge a spreadsheet into individual PDF documents

Updated 2026-07-16

A practical walkthrough of turning one CSV or Excel sheet into a personalized PDF per row — headers, field mapping, validation, and batch generation.

What a document merge actually does

A document merge (often called a mail merge) combines a fixed layout with variable data. The layout carries everything that stays the same — headings, paragraphs, tables, images — with placeholders such as {{employee_name}} where values change. The data supplies one row per document. Merging renders the layout once per row, substituting each row's values into the placeholders.

The quality of the result depends far more on the data than on the layout. A beautiful certificate with a misspelled name is still a reprint, which is why a serious merge workflow validates every row before generating anything.

Prepare the spreadsheet

  • Put the field names in the first row: employee_name, joining_date, annual_ctc. Short, consistent headers map automatically.
  • One row per document. If a document needs multiple line items, keep them in separate columns for the MVP table, or aggregate them into one cell.
  • Format dates consistently (YYYY-MM-DD is the safest) and keep amounts as plain numbers — the template controls display formatting.
  • Remove summary rows, merged cells, and notes above the header row; they confuse every import tool, not just this one.

Map columns to template fields

After import, each template field needs a source column. Exact name matches connect automatically; near-matches are suggested but wait for your confirmation, because a wrong automatic mapping is worse than a missing one. Required fields without a mapped column or a default value block generation — deliberately.

Validate before generating

Row validation catches the problems that ruin batches: empty required values, dates that cannot be parsed, non-numeric amounts, invalid email addresses, and two rows that would produce the same output filename. Fix the source where possible; exclude rows you cannot fix yet. Valid rows generate even when other rows fail, and failed rows can be retried on their own later.

Choose local or cloud generation

For a batch of up to 25 documents, local generation renders everything in your browser: no upload, no storage, no credits. For hundreds of documents, a cloud batch runs on a secure queue that records per-row results, packages a ZIP, and deletes outputs after a visible retention window. The rendering engine is the same in both modes, so the output is identical.

Put it into practice

DocForge's free tier generates up to 25 documents per batch locally in your browser — try the workflow with a starter template and sample data in about a minute.

Open DocForge