How to Mail Merge from a CSV File on Windows

How to Mail Merge from a CSV File on Windows - Rons Data Merge


You have a CSV file – a list of members, customers, products or students – and you need a letter, a page or a small text file for each one. The usual answer is Microsoft Word, but Microsoft's own advice for a CSV file is to import it into Excel first and set some columns to text, so leading zeros and other values survive the merge.

This guide shows how to do it in Rons Data Merge, a Windows application that opens the CSV file directly, merges each value exactly as it is written in the file (leading zeros and dates included), fills a template once per row and shows you each record before anything is written. You can follow along with the free Lite edition, which runs merges of up to 250 rows.

What You Need

  • Windows and Rons Data Merge (download; there is an installer and a portable version)
  • A CSV file, or any delimited text file (TSV, PSV, TAB, TXT), with column names in the first row
  • An idea of the result: one document for the whole list, or one file per row

Working from Excel? Rons Data Merge does not open .xlsx files, so save the sheet as CSV, or copy the table in Excel and paste it into Rons Data Merge.

1. Open the Table

Create a new merge and open your CSV file, or paste a table from the clipboard. The data appears in a grid.

  • If the columns look wrong, check the delimiter profile (separator, quoting, header row).
  • If accented letters look odd, check the encoding in Document Properties.

Look at the column names: they are the names you will use in the template. Rename a column here if Column3 would be clearer as First Name. You can also correct a cell, add or delete a row and sort the view, so the table is right before you merge.

2. Choose One Document or One File per Row

Pick the merge type:

You want Merge type Result
One file for the whole list (a report, a directory, an HTML table) Text, one document, or HTML, one document One file: the header once, the body once per row, the footer once
A separate file for each record (letters, certificates, product pages) Text, one file per row, or HTML, one file per row One file per row in the output folder, numbered or named from a column

Each type starts with a sample template you can edit, so you are never facing a blank page.

3. Write the Template

A template is the document with one row's values filled in. Type your text and insert column fields where the values go. The Insert menu lists the current columns, so you can pick First Name from a list rather than type the marker. A column called First Name becomes row.first_name in the template:

Dear {{ row.first_name }},

Your membership number is {{ row.member_number }}.

For a one-document merge, write the three parts separately: the header (written once at the top), the body (written for every row) and the footer (written once at the end). For one file per row, the template is the whole file.

To list every column without naming each one, use a column loop. A column added to the CSV later then appears in the output without editing the template:

{{ for column in columns }}
{{ column.name }}: {{ row[column.code] }}
{{ end }}

Templates use the Scriban template language; see What is Scriban for more examples. You can find and replace text in the template, as in any editor.

4. Preview the Records

Use first, previous, next and last to step through the rows and read each record filled into the template. For an HTML template, show the preview as a page and try a style (Plain, Editorial, Newsletter, Soft or Brief).

Check a few awkward rows: the longest name, an empty cell, a value with a comma or an apostrophe. Preview is not limited in the Lite edition, so you can check the whole list before deciding anything.

5. Run the Merge

Choose the output file (one document) or the output folder (one file per row), and decide whether existing files may be overwritten. Press Start. Stop cancels a run that is still going.

For one file per row, the files can be numbered in row order, or each file name can come from a column – for example the member number or last name – so the folder is easy to search.

6. Save the Merge

Save the job as a .merge file. It keeps the templates, the field mapping and the output settings, so next month you open the merge, load the new CSV and press Start again.

Tips

  • Keep the original CSV. Make changes in the grid and save a copy, so you can always go back.
  • One template, several outputs. Make a second merge with the same table for a different result, for example a one-document HTML directory and one letter per member.
  • Email instead of files? Choose the Mail type: see How to Send Personalised Emails from a CSV File.
  • AI prompts. The same method makes one AI prompt per row: write the prompt as a Text template with column fields, choose one file per row (or one document), and each row becomes its own prompt, ready to paste into an AI assistant or a batch tool.
  • JSON or XML? A Text template can write JSON or XML text, one document for the whole list or one file per row.
  • Printed labels or envelopes? Rons Data Merge does not print and does not make labels, envelopes, PDF or Word files; that is a job for Word's mail merge. See Rons Data Merge vs Microsoft Word Mail Merge.

Lite and Pro

The free Lite edition has every feature, with no time limit. It runs merges of up to 250 rows (loading and preview are not limited) and shows an advertising banner; in a business it is for evaluation. Rons Data Merge Pro removes the row limit and the banner, and is a one-time purchase of about US$17.50, not a subscription. Your table and templates stay on your computer, with no account and no cloud.

See Also