Catalog / Everyday Automation & AI Micro-Tools / AUTO-015

Recurring document generation from templates & data

Standard documents such as confirmations, protocols, certificates and short reports are generated automatically from a Word or PDF template plus data from a list or form, with an AI step drafting only the free-text parts, for SMB teams.

Quick win: proven, manageable effort, first results within weeks, low regulatory risk.

Parts needed to run it yourselfAgents & automationLanguage model

Many offices produce the same documents again and again: order confirmations, training certificates, inspection protocols, handover reports, monthly customer summaries. Staff copy an old file, replace names and numbers, and rewrite the same remarks. A template plus a data row does this reliably without any AI; an AI step is added only for the short free-text parts (summary, remark, polite wording). Typical result: documents appear within minutes of the data being entered, and people only review them.

Problem & value

  • Today: a clerk opens last month's Word file, overwrites fields, saves as PDF, renames and mails it; errors are stale values and wrong recipients.
  • Value: consistent layout, no copy-paste errors, automatic filing, and time saved per document. Realistic effort to build a first flow is one to three days; the saving depends on volume, so measure your own baseline first (minutes per document times documents per month).
  • Key principle: the template fills numbers, names and dates; the model writes only genuine free text, never amounts, dates or legal clauses.
  • Scope: short standard documents; complex proposals are LANG-003, serial letters AUTO-014.

Variants

  • Confirmations & certificates: order, appointment, training and handover documents, one per row (AUTO-008 delivers the rows).
  • Protocols & short reports: inspection protocols or monthly summaries with an AI-drafted remark paragraph (see AUTO-010).
  • Public sector: standard notices from a case list; legal wording stays fixed.

How it works

  1. trigger (new row / form submitted / status changed / schedule)
  2. fetch data row + validate required fields
  3. optional AI step: draft free-text fields from remarks (fixed style guide, max length)
  4. fill template (placeholders / content controls / repeating table rows)
  5. convert to PDF (PDF/A if archiving)
  6. human review of flagged documents (or sample check)
  7. name, file and send / hand to approval (AUTO-011)
  8. write status and link back to the list
  • AI step: an LLM receives only the fields it needs and returns text with a length limit; empty or odd output blocks the flow.
  • Human in the loop: AI-drafted passages are highlighted; first weeks every document is checked, later a sample plus flagged ones.

Data preparation

Which data: the source rows (names, addresses, dates, amounts, remarks), the master template, a style guide and a few approved example texts.

Where it lives: Excel or Sheets on file shares, SharePoint or Nextcloud, DATEV/ERP exports, and Word files that everyone copies.

Typical gaps: dates as text, several template versions, missing mandatory values, unclear template owner.

Preparation steps: 1. Pick one document type with a clear owner and collect 10-20 past examples (PREP-016). 2. Merge the template variants into one master with named placeholders; decide which parts are fixed text and which are free text. 3. Turn the source sheet into a tidy table with one row per document, fixed column names and validated formats (PREP-011). 4. Define mandatory fields (empty means stop and notify) and write a short style guide with three approved sample paragraphs.

Rough share of effort: about 40 percent, mostly template clean-up and column standardisation. See GUIDE-003.

Implementation paths

Which path for whom

  • SMB — Path B: the flow must connect your own Excel/SharePoint/ERP data and your own template; a thin build with Power Automate or n8n plus an EU-region model fits better than a product. If only a no-AI template fill is needed, Path A tools suffice.
  • Enterprise — Path B: templates, approval and archive integrate with existing DMS and CRM; central flow platform with an approved model endpoint.
  • Developer — Path C: open-source templating (docxtemplater, python-docx-template, Carbone) plus a local small model keeps everything in the own network.
  • Public — Path C: case and citizen data plus procurement rules favour self-operated or sovereign German-cloud hosting; fixed legal wording means AI use is minimal.

Path A — Buy (off-the-shelf)

  • Document automation products: Plumsail Documents, PDFMonkey, Templafy, Docmosis; check EU region and AVV.
  • Inside suites: Word mail merge, Copilot in Word, Gemini in Docs.
  • Microsoft 365: Power Automate with the "Populate a Microsoft Word template" action of the Word Online (Business) connector, a premium connector. It supports plain text, drop-down, combo box, image and repeating-section content controls, but not rich text or date pickers; control titles must be unique and conversion must finish in about two minutes [1].
  • Google Workspace: Apps Script replacing placeholders in a Docs copy and exporting PDF.
  • n8n (self-hosted or EU cloud): HTTP and file nodes plus a templating service such as Carbone.
  • AI step: an EU-region model (Azure OpenAI in an EU data zone, Mistral, or an EU-hosted open model) called with only the free-text fields; set temperature low and enforce a character limit.

Path C — Self-host (open source)

  • Templating: docxtemplater, python-docx-template or Carbone Community; PDF conversion: Gotenberg, an open-source Docker API that converts DOCX to PDF via LibreOffice [2].
  • Workflow: n8n community edition, with Nextcloud for storage and Paperless-ngx for archiving; Paperless-ngx exposes a REST API for uploads [3].
  • AI step: Ollama with a small model (about 7-8B, e.g. a Qwen, Llama or Mistral family model) runs on a normal CPU server or small GPU, hence HW1.
  • Choose C when: documents contain health, HR or sensitive customer data, or n8n/Ollama already serves AUTO-008 and AUTO-012.

Path D — Custom training

Not worthwhile. A good prompt with approved examples is enough for short passages.

State of the art (2026)

  • Reliable output comes from combining deterministic templating with schema-constrained LLM output for just the free-text fields.
  • Models write good German business text but invent facts from thin remarks; instruct them to use only supplied remarks.
  • Limits: placeholder typos, unsupported content controls, broken table layout, timeouts on large conversions.

Shared resources & combinations

  • Same stack as AUTO-008 (rows in), AUTO-011 (approval before sending), AUTO-014 (personalised wording), AUTO-007 (filing), AUTO-010 (periodic reports); one n8n or Power Automate environment and one small model serve all.
  • Generated files go into the DMS or Paperless-ngx; HW1 suffices for all of these.

Effort, cost & KPIs

  • Path A: hours to days; per-user or per-document pricing.
  • Path B: one to three days per document type; Power Automate premium licences per user or flow, model calls cost cents per document.
  • Path C: two to five days incl. server setup, then low upkeep; one small server.
  • KPIs: minutes saved per document, share of documents sent without correction, error rate found in review, time from trigger to document, number of template variants retired.

People & change

Involve early: department lead (template owner), the users who produce the documents, IT for connectors. The DPO is needed because rows usually contain names and addresses; an AVV (Art. 28 GDPR) with the model and flow provider is required, a DPIA is normally not (GUIDE-005, GUIDE-010).

Works council: depends. Flows that log who triggered, approved or corrected which document can be objectively suited to monitor behaviour under §87(1) no. 6 BetrVG (the Federal Labour Court holds objective suitability is enough). §90(1) no. 3 requires timely information on AI-supported work processes. Public bodies involve the Personalrat. A short works agreement excluding individual evaluation usually settles it (GUIDE-004).

AI literacy: Art. 4 AI Act requires measures that support staff's AI literacy; give a short session on checking AI-drafted passages and on what data may go into the AI step (GUIDE-006, GUIDE-007).

Pilot: present it as removal of copy-paste work; one document type, two to three users, two weeks parallel, one champion (GUIDE-008, GUIDE-009).

Humans in control: release before external sending at first.

Risks, regulation & compliance

  • EU AI Act: minimal risk for standard documents. If generated text is published to the public or imitates a person it may touch Art. 50 transparency duties, which apply since 2 Aug 2026; internal drafts reviewed by staff generally do not. If documents feed HR decisions or assessments, re-check Annex III (high-risk duties from 2 Dec 2027) (GUIDE-014).
  • GDPR: personal data in rows and documents; send the model only necessary fields, use EU hosting, define retention and deletion for generated files, avoid special categories in the AI step.
  • Other: invoices follow e-invoicing rules (DOC-001), not this flow.
  • Mitigations: review of AI text, test rows, mandatory-field stop, service accounts with least privilege (GUIDE-013).

Getting started

  1. Choose one frequent document and measure minutes per document and volume.
  2. Consolidate its template and tidy the source table into one row per document.
  3. Build the fill-and-PDF flow without AI first; check ten test rows.
  4. Add the AI step for one free-text field, with a style guide, length limit and review flag.
  5. Run parallel for two weeks, record corrections, then switch to sample checks.

Sources

  1. Microsoft Learn — Word Online (Business) connector, Populate a Microsoft Word template — https://learn.microsoft.com/en-us/connectors/wordonlinebusiness/
  2. Gotenberg — document conversion API — https://gotenberg.dev/
  3. Paperless-ngx — API documentation — https://docs.paperless-ngx.com/api/
  4. Regulation (EU) 2024/1689 (AI Act) — https://eur-lex.europa.eu/eli/reg/2024/1689/oj