Generate documents from a template

You will be able to produce quotes, letters or certificates automatically from a template and a row of data.

Build the document once as a template, with a gap wherever a detail changes, and let a flow fill the gaps from a row in your sheet. You can do this for quotes, letters, certificates or any document you send often. It replaces the habit of opening an old document, saving a copy and editing the details, which can leave parts of the previous client's document in the new one.

Arif works at a firm that sends quotations to homeowners. He is an invented example, as are the details below. For each quote he opens last month's quote for a similar job and saves a copy. He changes the homeowner's name and address, edits the line items, updates the date and quote number, and hopes he has removed every trace of the previous client. Twice in the past year he missed something. On one of those occasions, a homeowner in Bedok received a quote with someone else's Punggol address in the footer.

Building the template and its placeholders

Start in the document tool you already use, such as a word processor or a cloud document app. Make the document look exactly as the client should see it, with the logo, address block, headings, terms and signature line. Wherever a detail changes between documents, type a placeholder. A placeholder is a marker in the template that the automation replaces with real data.

Most document-filling automation tools look for placeholders in a particular format, often a field name in double curly brackets, for example {{client_name}}. Check the format your own tool expects. Name each placeholder to match a column header in your sheet as closely as you can, without spaces, so you can see at a glance which column feeds which gap. A quote like Arif's might use {{client_name}}, {{site_address}}, {{quote_number}} and {{quote_date}}.

Where possible, give each placeholder a line to itself instead of placing it mid-sentence. A long name or address then has space and won't disturb the layout. Type fixed text, such as your terms and payment details, as plain text so it reads the same on every document. Store the template where nobody can edit it by accident, ideally view-only for everyone except you as the owner.

Line items need extra care, because a quote with three items needs a different amount of space from a quote with twelve. Some tools can fill a table with a varying number of rows and some can't. If yours can't, build the line items as a single block of text in an earlier step of the flow, or keep many-line quotes as a manual job.

Mapping sheet columns into the template

The flow usually starts from a new or updated row in your sheet, for example a row whose status column changes to "ready to quote". The document step takes your template, and you map each placeholder to a column from that row. Lesson 2.2, Data mapping: passing fields from one step to the next, explains the mapping method.

Format values on their way into the document. Dates should be readable by a person, for example 14 March 2025, and amounts should carry the currency and two decimal places, for example S$1,250.00. Both are only examples of the format. Lesson 2.3, Format dates, names and numbers on the way through, shows how to set this up.

Some values have to be assembled in an earlier step. In Arif's first generated batch, the quote numbers came through as 142 when he wanted Q-0142. The sheet stored only the number, and the prefix existed only in his head. He added a formatting step before the document step to build the full quote number.

Exporting, naming and filing the PDF

Export the filled document to PDF. The client can't edit it by accident, and it looks the same on every device.

Name every file from the record, with the fields in the same order each time, for example quote number, client surname and date. That produces names such as Q-0142_Tan_2025-03-14.pdf, which you can sort and search in the folder later.

Save each PDF to a named folder organised the way your office looks things up: by client, by month or by job. A firm that files by month uses a folder per month. Arif's firm thinks in jobs, so each job has a folder and the quote is saved into it.

Have the flow write the file's link back into the sheet, in its own column, so anyone viewing the row can open the exact document that was sent. Lesson 6.2, Pull data out of invoices, receipts and PDFs, keeps the original invoice link in the sheet on the same principle.

At first, don't let the flow email the document to the client automatically. Set it to save the file and notify the person responsible, who checks it and sends it.

Checking the first ten documents by hand

The first generated documents show up problems the template hid. A long address can push the signature onto a second page. A client name with an apostrophe can display oddly. A placeholder you forgot to map prints as it was typed, so the client sees {{site_address}} where their address should be.

Open each of the first ten documents and go through every page against the row it came from, checking these four things:

the layout every filled field the file name the destination folder

If anything is wrong, fix the template or the mapping and regenerate the document. After ten clean documents, you can move to spot checks.

Pick one document you send often. In the activity below you will turn it into a template with placeholders, then generate three versions from test rows in your sheet and check each one.

Create a template for one document you send often and generate three versions from test rows in your sheet.

Course

Junxiong-WFG Organisation is an authorised representative of AIA Financial Advisers Private Limited (Reg. No. 201715016G).