Generate documents from a template

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

Make the document one time as a template, leaving a gap for each detail that varies. An automation flow then fills each gap from a row in your sheet. Quotes, letters, certificates and anything else you send often can all be handled this way.

The risk in editing an old quote

Arif (an invented example, as are all his details) sends quotations to homeowners for his firm. For each new quote he opens last month's quote for a similar job and saves a copy. Then he puts in the new homeowner's name and address, edits the line items, changes the date and quote number, and hopes nothing from the previous client is left. Twice in the past year he missed something. On one occasion a homeowner in Bedok got a quote with another client's Punggol address in the footer.

A template avoids this. Each document starts from the same clean file, and the details that change come from the sheet, so no earlier client's text is carried over.

Laying out the template and its placeholders

Use the document tool your office already works in, for example a word processor or a cloud document app. Lay the page out to match what the client will receive, with the logo, address block, headings, terms and signature line all in place.

Wherever the content differs from one document to the next, type a placeholder. This is a marker that the automation replaces with real data. Document-filling tools usually want placeholders written in a set way. A common pattern is the field name inside double curly brackets, like {{client_name}}. Confirm which pattern your tool uses before you start. Arif's quotes could use {{client_name}}, {{site_address}}, {{quote_number}} and {{quote_date}}.

Name each placeholder as close as you can to the header of the sheet column that will fill it, with no spaces. That way anyone can see which column feeds which gap. If you can, give each placeholder its own line so a long name or address has room and the layout stays intact. Terms, payment details and other wording that never changes go in as ordinary typed text, so every copy says the same thing. Keep the template somewhere it can't be changed by mistake. The best arrangement is view-only for everyone except the owner.

Line items take more thought. Three items need less room on the page than 12 (illustrative counts). Some tools can fill a table with however many rows the record has, and others can't. If yours can't, an earlier step in the flow can join the line items into a single block of text. Or you can keep doing quotes with many lines by hand.

Wiring the flow from sheet row to document

A typical trigger is a new or changed row in the sheet, for instance when its status column is set to "ready to quote". You point the document step at your template and match each placeholder to a column in that row. Lesson 2.2, Data mapping: passing fields from one step to the next, shows how to do the matching.

Format values as they go into the document. A date should be easy for a person to read, for example 14 March 2025. An amount should show its currency and two decimal places, for example S$1,250.00 (both show the format only). The setup for this is in Lesson 2.3, Format dates, names and numbers on the way through.

Some values aren't stored in the sheet in their finished form, so an earlier step has to put them together. When Arif ran his first batch, the quotes showed 142 where they should have shown Q-0142. The sheet held only the number, and the prefix existed only in his head. He added a formatting step before the document step, and it now builds the full quote number.

Saving, naming and filing the PDF

Have the flow export the filled document as a PDF. The client can't change a PDF by accident, and it looks the same on any device.

Build every file name from the record, with the same fields in the same order each time. For example, use quote number, then client surname, then date: Q-0142_Tan_2025-03-14.pdf. Names built this way let you sort and search the files. Save each PDF in a named folder that follows how your office looks things up, whether that's by client, by month or by job. A firm that files by month keeps one folder per month. Arif's firm thinks in jobs, so every job has its own folder and the quote goes into it.

The flow should also write the file's link back into the sheet, in its own column. Then anyone looking at the row can open the exact document that was sent. Lesson 6.2, Pull data out of invoices, receipts and PDFs, uses the same principle and keeps the original invoice link in the sheet.

For the early runs, don't let the flow email the document to the client automatically. Have it save the file and notify the person responsible, who checks the document and sends it.

Checking the first ten by hand

The first real documents show problems the template hid. A long address may push the signature onto a second page. An apostrophe in a client's name may display oddly. If a placeholder was never mapped, it prints exactly as you typed it, and the client sees {{site_address}} instead of their address.

Check every page of each of the first ten documents against the row it came from. Look at the layout, every filled field, the file name and the folder the file was saved to. If something is wrong, fix the template or the mapping and generate the document again. Once ten documents have come through clean, switch 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.

Make a template for one document you send often, then 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).