QuarkXPress 2018 offers a sample script that solves this simple mail merge problem and you are done in a few minutes. If you have more complex scenarios, feel free to modify and enhance the sample JavaScript, its code is open.

Step 1: Define your data

Define your data, either by using a spreadsheet (e.g. Microsoft Excel), a database or a simple text editor.

You can use images and text. In the sample script we use one image per letter and several fields, like name, salutation, subject and greeting.

First, in the first row define the names of the fields. You can use any name for your field names, it is better for troubleshooting if you use self-explanatory names.

Now we need the data as a CSV (comma-separated values) file. You can use different separators, tabs, commas, semicolons, just make sure that you always use the same one to separate data. If you used MS Excel to create your data, you can save as CSV and specify your separator. Make sure that you do not use a separator that’s within your data.


Step 2: Create a template

Now in QuarkXPress 2018 create a template, so just a QuarkXPress document with your letter.

Whenever you have variable data (the address, the image) make sure that you put these boxes, text box or picture box, on a master page.

You can find the sample template (qpt file) here: https://github.com/qxpjs/Mail-merge/tree/master/mailmerge-data


Step 3: Insert placeholders

Wherever you need variable data, e.g. the personalized subject line, don’t type the data. Instead, type the field name (header name) that you used in the CSV file, surrounded by two brackets.

So the first word “Subject” will appear like this in your final output. The word “<<Subject>>” will be replaced by the data.

As this is just text, style it manually or use style sheets for the placeholder.

Step 4: Run the script

This “mail merge” script is contained with QuarkXPress 2018 as a script.

Open your “JavaScript” palette (Window menu). Navigate to the Samples folder (in the JavaScript palette) and then to the “Automation” folder.

Double click the “Mail Merge.js” or select it and click on the Run button.

QuarkXPress will now create pages, one for each record defined in your CSV file.

Please note that QuarkXPress has a limitation of 2000 pages per layout, so if you have more records, first split the data to chunks of not more than 2000.


Step 5: Export PDF

You can now either print the layout containing all pages (or create one large PDF).

Alternatively, you can create one PDF per page, by choosing the appropriate output option “Export pages as separate PDFs” in the PDF Export dialog:


A Quick video in the link showing this example:- https://youtu.be/DkRw2-TF4dU