Home
cd ../playbooks
ProductivityIntermediate

Document Template Engine

Auto-fill document templates with data - mail merge for any format

10 minutes
By communitySource
#template#engine#autofill#docxtpl

You need to generate 200 personalized contracts from a spreadsheet but Word mail merge can't handle your complex template with conditional sections. This playbook auto-fills document templates with data from any source — like mail merge but for any format, with logic, loops, and conditional content.

Who it's for: operations managers generating hundreds of personalized documents from spreadsheet data, legal teams producing customized contracts from client data templates, HR departments automating offer letters and onboarding documents, sales teams creating personalized proposals from CRM data, administrative staff producing certificates, invoices, or reports from data sources

Example

"Generate 150 personalized vendor agreements from our contractor spreadsheet" → Template engine pipeline: template design with placeholder fields and conditional sections, data source connection to spreadsheet or CSV, field mapping between data columns and template variables, batch document generation with per-record customization, and output as individual PDFs or DOCX files named by vendor

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

Or install from your terminal:
npx ccplaybooks add template-engine
# Template Engine

## Overview

This workflow enables template-based document generation - define templates with placeholders, then automatically fill them with data. Works with Word, Excel, PowerPoint, and more.

## How to Use

1. Describe what you want to accomplish
2. Provide any required input data or files
3. I'll execute the appropriate operations

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

This workflow enables template-based document generation - define templates with placeholders, then automatically fill them with data. Works with Word, Excel, PowerPoint, and more.


Quick Start

Step 1: Create a Project Folder

mkdir -p ~/Documents/TemplateEngine

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ~/Documents/TemplateEngine/

Step 3: Start Working

cd ~/Documents/TemplateEngine
claude

How to Use

  1. Describe what you want to accomplish
  2. Provide any required input data or files
  3. I'll execute the appropriate operations

Example prompts:

  • "Mail merge for bulk letters/contracts"
  • "Generate personalized reports from data"
  • "Create certificates from templates"
  • "Auto-fill forms with user data"

Best Practices

  1. Use clear placeholder naming ({{client_name}})
  2. Validate data before rendering
  3. Handle missing data gracefully
  4. Keep templates version-controlled

Installation

# Install required dependencies
pip install python-docx openpyxl python-pptx reportlab jinja2

$Related Playbooks

Productivity

Session Capture & Handoff

Capture key decisions, open questions, and follow-ups at the end of each work session for seamless cross-session continuity.

5 minutes
Beginner
Productivity

Smart Email Triage

Automate Gmail inbox organization with intelligent classification into newsletters, announcements, expenses, and auto-archive categories.

30 minutes
Advanced
Productivity

System Performance Diagnostics

Run comprehensive performance checks to diagnose why your computer is running slow and get prioritized fixes.

5 minutes
Beginner
Productivity

PDF to Readable HTML

Convert a PDF into one self-contained, readable HTML file that preserves images, tables, charts, and reading order — optionally translating it while keeping every figure intact.

10 minutes
Intermediate
Productivity

AI Prompt Builder

Turn rough ideas into optimized, high-performance prompts for any AI model — eliminates ambiguity, adds the right context, and structures output expectations so you get better results on the first try.

5 minutes
Beginner
Productivity

Processize Before You Productize

Turn any product idea into a manual process you can deliver today — before writing a line of code. Document the 'magic piece of paper,' charge for it, then automate only what you've proven works.

10 minutes
Beginner
Productivity

Region Config

Configure regional settings.

15 minutes
Intermediate
Productivity

Save Knowledge

Save brand knowledge to memory.

15 minutes
Intermediate
Productivity

Validate Output

Validate content structure.

15 minutes
Intermediate
Productivity

Verify Claims

Verify marketing claims.

15 minutes
Intermediate
Productivity

Weather-Based Automation

Automate weather-based workflows, forecasts, alerts, and location-aware notifications

10 minutes
Intermediate
Productivity

Weekly Status Report Generator

Transform scattered notes, emails, and task updates into polished weekly status reports in minutes instead of hours.

10 minutes
Beginner

Browse all Productivity playbooks →