Claude Code for Non-Developers
Automating Repetitive Tasks

Mail Merge and Templates

Use Claude Code to generate personalized documents from a template and a spreadsheet

The template pattern

Sometimes you don't need to analyze data or move files around. You need to take one file and make many versions of it, each with different details filled in.

A personalized email for every contact on a list. An individual report for each region in a spreadsheet. A custom proposal for every client in your pipeline.

This is the template pattern: one structure, many outputs. You've probably done this by hand before. Copy the file, replace the name, change the numbers, save a new version, repeat 50 times. Claude Code can do the entire loop for you.

How templates work with Claude Code

The idea is straightforward. You give Claude Code two things:

  1. A template — the file with placeholder spots where personalized details go
  2. A spreadsheet or list — the file with the details for each version

Then you describe what you want: "For each row in this spreadsheet, fill in the template and save a separate file."

Claude Code reads the data, loops through each row, fills in the blanks, and saves the results. Behind the scenes, it writes a short script (a saved set of instructions your computer can run) to handle the repetition, but you never need to see or understand that script. You describe the pattern and review the output.

Describing a template

You don't need to create a formal template with special syntax. There are two ways to show Claude Code what you want.

Option 1: Show it an example. Write one finished version, a real email or a completed report. Then tell Claude Code which parts should change for each person.

Here's an example email I sent to one client:

"Hi Sarah, thanks for your order of 12 units on January 15.
Your total was $480. We'll ship to your address at
123 Oak Street, Portland."

I have a CSV called orders.csv with columns for name, quantity,
date, total, and address. Generate a similar email for each row
and save them as individual text files in a folder called emails/.

Claude Code sees the pattern in your example and applies it to every row.

Option 2: Describe the structure. If you don't have a finished example, describe what the output should look like.

I have a spreadsheet called team-data.csv with columns for
name, department, q4_revenue, and q4_target.

For each person, create a one-page performance summary that includes:
- Their name and department as a header
- A sentence comparing their revenue to their target
- Whether they hit, exceeded, or missed their target
- Save each file as summaries/{name}-q4-summary.txt

Both approaches work. The example approach is usually faster because Claude Code can match the style and structure exactly. The descriptive approach gives you more control over what goes into each file.

A practical walkthrough

Say you're an operations manager with a quarterly review coming up. You need to send a personalized summary to each of your 30 team members, covering their metrics, highlights, and next steps.

You have a spreadsheet called team-reviews.csv with columns: name, role, deals_closed, revenue, highlight, and next_step.

Start Claude Code in the folder where your CSV lives, and type:

Read team-reviews.csv. For each row, generate a personalized
quarterly review document. Use this format:

Q4 Quarterly Review — [name]
Role: [role]

Performance Summary:
You closed [deals_closed] deals this quarter, generating
[revenue] in revenue.

Highlight: [highlight]

Next Steps: [next_step]

Save each review as reviews/[name]-q4-review.txt

Claude Code reads the CSV, creates the reviews/ folder, and generates 30 individual files. You see something like:

Created reviews/ folder and generated 30 review files:
- reviews/Sarah-Chen-q4-review.txt
- reviews/Marcus-Johnson-q4-review.txt
- reviews/Priya-Patel-q4-review.txt
... (27 more files)

Each file contains a personalized Q4 review based on
the data in team-reviews.csv.

Each file has that person's real data filled in. The whole process takes a couple of minutes.

If any of the results need tweaking, maybe the formatting isn't quite right or you want to add a greeting line, tell Claude Code what to change and it updates all 30 files at once.

Common template tasks

Here are template tasks that come up regularly for non-developers.

Personalized emails from a contact list

You have a CSV of contacts and want to draft an email for each one. Claude Code generates the drafts as text files, one per contact, that you can then copy into your email tool.

Heads up: Claude Code creates the text of the emails. It doesn't send them. You'll copy each draft into your email client, or use them as a starting point for your own edits.

Individual reports from a spreadsheet

You have sales data broken down by region, store, or team member. Instead of one big report, you want a separate summary for each. Tell Claude Code: "For each unique region in this CSV, create a report showing that region's metrics."

Form letters with variable content

Offer letters, welcome packets, renewal notices, thank-you notes. Anything where the structure stays the same but the details change per recipient.

Invoices or receipts

Give Claude Code a template and a list of transactions. It generates a formatted file for each one, with the right amounts, dates, and client names.

Repeatable reports from raw data

The template pattern works for more than one-per-row output. You can also use it for repeatable workflows where the structure stays the same but the data changes each time.

Dan Shipper at Every.to uses a version of this. His workflow: drop credit card transaction files into a folder, then tell Claude Code to generate a categorized expense report as a web page. One instruction, one folder, and a few minutes later he has a complete expense tracker with transactions sorted by category, totals, and individual line items, all in an HTML page he can open in his browser.

What makes this worth mentioning isn't the time saved on one report. It's that the same instruction works every time he gets new transaction data. Drop the new files in the folder, run the same prompt, and the updated report appears.

This is a repeatable structure (the expense report layout) filled with variable data (this month's transactions). Whether you're generating 30 individual reviews or one summary report that refreshes monthly, the core idea is the same: describe the output once, reuse the pattern whenever new data shows up.

Templates beyond text files

Claude Code can generate more than plain text.

HTML pages

If you want each output to look polished, with headers, colors, and formatting, ask Claude Code to generate HTML files instead of text files. You can open them in any browser, and they'll look like real pages.

Spreadsheets

Claude Code can write CSV files with calculated fields for each row, giving you a new spreadsheet derived from your template logic.

Formatted documents

For Word files or PDFs, Claude Code uses libraries that handle the formatting behind the scenes. It can read an existing Word file as a template and produce filled-in copies, though complex formatting (tables, images, headers and footers) may need a spot-check.

Tip: For the most reliable results, use HTML output. Claude Code generates clean HTML pages that look professional in a browser and are easy to verify. Word and PDF output works but is more likely to need formatting tweaks.

Getting the details right

Template tasks sound straightforward, but a few things can trip you up.

Column name mismatches. If your spreadsheet has a column called "Full Name" but your instructions say "name," Claude Code usually figures it out. But if there are several similar columns, like "name," "contact_name," and "billing_name," be specific about which one you mean.

Missing data. Some rows in your spreadsheet might have empty cells. Decide upfront what you want: skip those rows, use a placeholder like "N/A," or leave the field blank. Tell Claude Code your preference in the original instruction.

Inconsistent formatting. If your data has mixed formats, some dates as "01/15/2026" and others as "January 15, 2026," the output will be inconsistent too. Clean the data first (Module 3 skills) or tell Claude Code how to standardize it.

Large spreadsheets. For hundreds of rows, Claude Code handles the volume without issues. It writes a script that loops through every row, so the file count doesn't slow it down. But spot-check a few outputs from different parts of the list, not just the first three.

What's next

You've now covered all the automation patterns in this module: file operations, text processing, document handling, and template-based generation. Next, you'll learn how to save these workflows as slash commands, reusable shortcuts that turn a multi-step process into a single word you type.

On this page