Skip to content

PDF Mail Merge from CSV Files

Use CSV or TSV files as your data source for PDF mail merge. Import comma-separated, semicolon-separated, or tab-separated data for personalized documents.

What Is PDF Mail Merge from CSV?

PDF mail merge from CSV lets you use a comma-separated or tab-separated text file as the data source for generating personalized PDF documents. Each row in your CSV produces one filled-in PDF — invoices, certificates, labels, contracts, or any document type.

CSV is the universal export format — nearly every database, CRM, ERP, and spreadsheet application can export to CSV. If your data lives in Salesforce, HubSpot, Airtable, Notion, MySQL, or any system that has an “Export to CSV” button, you can merge it into PDFs with Mergram.

Prerequisites


How to Mail Merge from CSV

Step 1 — Upload Your PDF Template

Open the Mergram editor and upload a PDF file from your computer. You can also import a Canva design directly. Your template defines the static content — logos, headings, borders — that stays the same across all generated documents.

Step 2 — Upload Your CSV File

In the Data Source tab, drag your .csv or .tsv file into the editor. Mergram auto-detects the delimiter and reads the file:

DelimiterFormatCommon In
Comma (,)Standard CSVUS/UK locales, most CRM exports
Semicolon (;)European CSVGermany, France, Italy, Spain
Tab (\t)TSVDatabase exports, terminal output

The first row becomes column headers. Each subsequent row is one record to merge. You don’t need to specify the delimiter — Mergram detects it automatically.

File extensions

Use .csv for comma-separated or semicolon-separated files. Use .tsv for tab-separated files. Mergram handles both extensions transparently.

Step 3 — Place Data Fields

Drag column headers from the sidebar onto your PDF pages. Each column becomes a positioned field you can configure:

Position fields on any page, resize freely, and use snap-to-center guides for alignment.

Step 4 — Preview & Generate

Use the row selector to preview any row rendered in your browser — no server round-trip needed. When you’re satisfied:

Background workers handle up to 100,000 rows with progress tracking and pause/resume support.


CSV Format Details

Basic Structure

A CSV file for mail merge looks like this:

Name,Email,Amount,Due Date,Invoice Number
Alice Chen,alice@example.com,"$1,500.00",2025-02-15,INV-0042
Bob Martinez,bob@example.com,"$2,300.00",2025-02-15,INV-0043
Carla Müller,carla@example.com,"$980.00",2025-02-20,INV-0044

Rules:

Delimiter Auto-Detection

Mergram analyzes your file and detects the delimiter automatically:

  1. Comma — Standard CSV, the most common format worldwide
  2. Semicolon — Used in European locales where the comma is the decimal separator
  3. Tab — TSV format, common in database exports and terminal tools

You don’t need to configure anything — just upload the file.

Encoding Support

Mergram handles two character encodings:

EncodingWhen to Use
UTF-8Default for modern systems. Supports all languages and scripts.
Latin-1 (ISO 8859-1)Legacy exports from older systems. Covers Western European characters.

Character encoding

If your CSV contains accented characters (café, über, español) or non-Latin scripts (日本語, 한국어, Текст), save it as UTF-8 for best results. Most modern export tools default to UTF-8.


Common CSV Sources

CSV is the lingua franca of data exchange. Here are common sources for CSV data:

SourceExport MethodTypical Use Case
SalesforceReports → Export DetailsClient invoices, contracts
HubSpotLists → ExportMarketing letters, follow-ups
AirtableView → Download CSVProject documents, reports
NotionDatabase → Export as CSVTeam directories, checklists
Google SheetsFile → Download → CSVSame as Google Sheets integration
MySQL / PostgreSQLCOPY or SELECT INTO OUTFILEDatabase-driven document generation
ShopifyAdmin → ExportPacking slips, order confirmations
EventbriteEvents → ExportAttendee badges, tickets

Automation with the REST API

For fully automated workflows, skip the CSV export step and send JSON data directly via the REST API. Trigger merges from Zapier, Make.com, or your own application.


CSV Preparation Tips

Cleaning Your Data

Before uploading a CSV file, check these common issues:

  1. Consistent headers — Ensure the first row has unique, descriptive column names
  2. No blank rows at the top — The first row must be headers, with no empty rows above
  3. Trim whitespace — Extra spaces in values can affect field rendering
  4. Date formatting — Use a consistent date format across all rows (e.g., YYYY-MM-DD)
  5. Quoted fields — Values containing commas must be wrapped in double quotes

Handling Large CSV Exports

For large datasets:

Converting from Other Formats

If your data isn’t already in CSV format:


Best Practices

  1. Use UTF-8 encoding — Ensures all characters display correctly, especially for international data
  2. Keep headers simple — Use First_Name or First Name rather than First Name (Primary Contact)
  3. Validate with a spreadsheet app first — Open the CSV in Excel or Google Sheets to verify the data looks correct before uploading
  4. Preview multiple rows — Check at least 2–3 rows in the browser preview to verify formatting
  5. Save your template — After placing fields, save the template so you can re-merge with updated CSV data without re-placing fields
  6. Use semicolons for European data — If your data uses commas as decimal separators, export with semicolons as the delimiter

Get Started

Export your data as CSV, upload it to Mergram along with a PDF template, and generate personalized documents in minutes. No format conversion needed — comma, semicolon, or tab, Mergram handles them all.

Try it free: mergram.com/new

Prefer a different data source? See PDF Mail Merge from Excel or PDF Mail Merge from Google Sheets.

Step-by-step guide

  1. 1

    Upload Your PDF Template

    Upload a PDF file or import a Canva design. This is your static layout that stays the same across all generated documents.

  2. 2

    Upload Your CSV File

    Drag your .csv or .tsv file into the editor. Mergram auto-detects the delimiter (comma, semicolon, or tab) and reads the first row as column headers.

  3. 3

    Place Data Fields

    Drag column headers from the sidebar onto your PDF pages. Choose rendering type — text, QR code, barcode, or image.

  4. 4

    Preview & Generate

    Preview any row in your browser, then generate — individual PDFs (ZIP), a combined PDF, or email delivery. Up to 100,000 rows per job.

Frequently asked questions

Can I use a CSV file for PDF mail merge?
Yes. Upload any .csv or .tsv file to Mergram. The first row is used as column headers and each subsequent row becomes one merged PDF. Comma, semicolon, and tab delimiters are auto-detected.
What delimiter formats does Mergram support?
Mergram auto-detects three delimiter types: comma (standard CSV), semicolon (common in European locales), and tab (TSV files). You don't need to specify the delimiter manually.
Does Mergram handle non-English characters in CSV files?
Yes. Mergram supports UTF-8 and Latin-1 encoded CSV files, so accented characters (é, ñ, ü), CJK scripts (日本語, 한국어), Cyrillic (фото), and Vietnamese tone marks (tài) all display correctly.
Can I export data from my CRM as CSV and merge directly?
Absolutely. CSV is the universal export format — Salesforce, HubSpot, Airtable, Notion, and virtually every database and CRM can export to CSV. Export your data, upload to Mergram, and merge.
What is the maximum CSV file size?
Mergram supports up to 100,000 rows in a single merge job, regardless of whether the source is CSV, Excel, or Google Sheets. There's no strict file size limit — the row count is the constraint.
What is the difference between CSV and TSV?
CSV (Comma-Separated Values) uses commas between fields. TSV (Tab-Separated Values) uses tabs. Mergram handles both transparently — upload either format and the delimiter is detected automatically.

Ready to try it yourself?

Start merging PDFs in minutes — free account required, no credit card needed.

Related articles