# Mail Merge

> Create invoices from workbook templates and JSON records: bindings, repeat blocks, merge policies and a report pipeline in the browser, .NET and Node.js.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Sheet Control > Mail Merge
- **741 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/mail-merge/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/mail-merge/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/mail-merge/llms-full.txt

---

One template, one invoice for each customer: mail merge combines a reusable workbook template with JSON records, such as a customer and its line items. What follows covers how a merge works on each platform, how to design templates that hold up with real data and how to build a complete pipeline from the template to a delivered PDF.

The examples use the invoice of the [Sample Documents](https://docs.textcontrol.com/tx-sheet-control/overview/sample-documents/llms-full.txt): a template, its JSON record, the merged XLSX and the PDF.

### How Mail Merge Works

A merge brings a template, a record and a merge operation together:

- **The template** is a workbook with values, formulas, styles, print settings and declarative bindings. You design it on the **Reporting** tab of the browser editor or define its bindings in code, and save it as TXWB to retain them.
- **The record** is JSON data that your application validates and authorizes. A fixed binding writes a single value, such as `customer.name`, into a cell. A repeat block expands a band of template rows for each element of an array, such as `items`.
- **The merge** fills the template. Formula cells calculate the amounts and totals after the expansion, and the merge returns diagnostics: warnings, formula errors and repeated ranges.

The merge runs in the browser editor with a captured template, or without a browser in the server packages `@txtextcontrol/tx-sheet-control-server` for Node.js and `TXTextControl.TXSheetControl.Server` for .NET. Every unrelated merge starts from a clean copy of the template, never from a document that is already expanded.

### Find the Right Page

| If you want to | Read |
|---|---|
| Inspect the bindings of a template in the editor | [Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt) |
| Define bindings in code and merge a record in the browser, Node.js or .NET | [Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt) |
| Choose safe binding paths, data types and policies for missing and null values | [Merge Policies and Template Design](https://docs.textcontrol.com/tx-sheet-control/mail-merge/template-design/llms-full.txt) |
| Design repeat bands, persist templates in TXWB and process batches of invoices | [Merge Policies and Template Design](https://docs.textcontrol.com/tx-sheet-control/mail-merge/template-design/llms-full.txt) |
| Follow an invoice from the template and the data to a checked and delivered PDF | [Invoice Report Pipeline](https://docs.textcontrol.com/tx-sheet-control/mail-merge/report-pipeline/llms-full.txt) |
| Fix blank fields, duplicate rows or wrong totals | [Mail Merge](https://docs.textcontrol.com/tx-sheet-control/troubleshooting/mail-merge/llms-full.txt) in Troubleshooting |

### Where to Start

1. [Sample Documents](https://docs.textcontrol.com/tx-sheet-control/overview/sample-documents/llms-full.txt): download the invoice template and its data.
2. [Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt): merge the invoice on the platform you use.
3. [Merge Policies and Template Design](https://docs.textcontrol.com/tx-sheet-control/mail-merge/template-design/llms-full.txt): make your own templates work with real data.
4. [Invoice Report Pipeline](https://docs.textcontrol.com/tx-sheet-control/mail-merge/report-pipeline/llms-full.txt): put validation, merge, export and delivery together.

### Pages in This Section

- [Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt): inspect a field in the invoice template, define bindings and repeat blocks and merge in the browser, Node.js and .NET.
- [Merge Policies and Template Design](https://docs.textcontrol.com/tx-sheet-control/mail-merge/template-design/llms-full.txt): safe paths and types, missing-data policies, repeat bands, persistence and batches.
- [Invoice Report Pipeline](https://docs.textcontrol.com/tx-sheet-control/mail-merge/report-pipeline/llms-full.txt): the five steps from authoring the template to delivering the PDF and releasing the processing owners.

---

## In This Section

- [Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt): Merge JSON records into workbook templates with bindings and repeat blocks in the browser, Node.js or .NET, check the diagnostics and export the invoice as PDF.
- [Invoice Report Pipeline](https://docs.textcontrol.com/tx-sheet-control/mail-merge/report-pipeline/llms-full.txt): Build an invoice report pipeline: author a TXWB template, validate data, merge a clean copy in .NET, Node.js or the browser, check the total and deliver a PDF.
- [Merge Policies and Template Design](https://docs.textcontrol.com/tx-sheet-control/mail-merge/template-design/llms-full.txt): Design mail merge templates for real data: safe binding paths and types, MailMergeOptions policies for missing and null values, repeat bands, TXWB and batches.

---

## Nearby

- **Previous:** [Generic and HTTP Data](https://docs.textcontrol.com/tx-sheet-control/dashboards/data-connections/llms-full.txt)
- **Next:** [Mail Merge With JSON](https://docs.textcontrol.com/tx-sheet-control/mail-merge/overview/llms-full.txt)
