-
Notifications
You must be signed in to change notification settings - Fork 0
Examples & Templates
Aurghyadip edited this page Aug 3, 2026
·
1 revision
This page provides copy-paste ready Typst code snippets for popular mail merge applications.
#import "@preview/mailmerge:0.1.0": mail-merge, field, fmt-field, join-fields, if-field
#mail-merge(
csv("data/clients.csv", row-type: dictionary),
filter: record => field(record, "Status") == "Active",
sort-by: "Last Name",
reset-page-counter: true,
record => [
#align(right)[#datetime.today().display("[Month repr:long] [Day], [Year]")]
#v(1cm)
#block(
fill: rgb("#f8fafc"),
inset: 12pt,
radius: 4pt,
[
*#fmt-field(record, "First Name") #fmt-field(record, "Last Name")* \
#if-field(record, "Company", c => [#c \ ])
#field(record, "Address 1") \
#join-fields(record, ("City", "State"), separator: ", ") #field(record, "Zip")
]
)
#v(1cm)
*Dear #field(record, "First Name"),*
Thank you for choosing Acme Services. Below is the summary of your account balance:
#table(
columns: (1fr, auto),
[Account Status], [Active],
[Outstanding Balance], [*#fmt-field(record, "Balance", fmt: "currency")*],
)
Best regards, \
The Acme Support Team
]
)#import "@preview/mailmerge:0.1.0": mail-merge, field, fmt-field
#set page(paper: "us-letter", flipped: true, margin: 0.5in)
#mail-merge(
csv("data/students.csv", row-type: dictionary),
record => [
#rect(
width: 100%,
height: 100%,
stroke: 3pt + rgb("#1e3a8a"),
inset: 20pt,
[
#align(center)[
#text(size: 28pt, weight: "bold", fill: rgb("#1e3a8a"))[CERTIFICATE OF COMPLETION]
#v(1cm)
#text(size: 14pt)[This certificate is proudly presented to]
#v(0.5cm)
#text(size: 24pt, weight: "bold", style: "italic")[
#fmt-field(record, "First Name") #fmt-field(record, "Last Name")
]
#v(0.5cm)
#text(size: 14pt)[for successfully completing the course] \
#text(size: 16pt, weight: "bold")[#field(record, "Course Name")]
#v(1.5cm)
#grid(
columns: (1fr, 1fr),
align(center)[
#line(length: 60%)
#text(size: 10pt)[Instructor Signature]
],
align(center)[
#line(length: 60%)
#text(size: 10pt)[Date: #datetime.today().display("[Month repr:long] [Day], [Year]")]
]
)
]
]
)
]
)#import "@preview/mailmerge:0.1.0": mail-merge-labels, presets, field, fmt-field, join-fields
#mail-merge-labels(
csv("data/clients.csv", row-type: dictionary),
preset: presets.avery-5160,
show-cut-lines: true,
record => [
#text(size: 9pt, weight: "bold")[#fmt-field(record, "First Name") #fmt-field(record, "Last Name")] \
#text(size: 8pt)[
#field(record, "Address 1") \
#join-fields(record, ("City", "State"), separator: ", ") #field(record, "Zip")
]
]
)#import "@preview/mailmerge:0.1.0": mail-merge-labels, presets, field, fmt-field
#mail-merge-labels(
csv("data/attendees.csv", row-type: dictionary),
preset: presets.badge-2x4,
show-cut-lines: true,
fill: record => if field(record, "Role") == "VIP" { rgb("#fef3c7") } else { rgb("#ffffff") },
record => [
#align(center + horizon)[
#text(size: 16pt, weight: "bold")[#fmt-field(record, "First Name") #fmt-field(record, "Last Name")] \
#v(4pt)
#text(size: 11pt, style: "italic", fill: rgb("#475569"))[#field(record, "Organization")] \
#v(8pt)
#rect(
fill: rgb("#1e293b"),
radius: 3pt,
inset: (x: 8pt, y: 3pt),
text(size: 9pt, weight: "bold", fill: white)[#field(record, "Role", fmt: "upper")]
)
]
]
)