How to create mail merge documents with Pages and Numbers

pages icon

Reader Ann Grace wishes to send form letters to her clients. She writes:

I’ve recently upgraded to OS X Yosemite as well as to the latest versions of Apple’s Numbers and Pages apps. Is there a way I can use the two of them to create mail merge documents?

There is, although it’s not a feature directly built into either app. This is possible through the power of AppleScript (don’t worry, I’m not going to ask that you learn AppleScript in order to carry out this job). Instead, I’ll direct you to the Mac OS X Automation site. Here you’ll find an AppleScript and Pages page that provides instructions for using the free Pages Data Merge utility (the page also includes a link to that utility). As its name suggests it lets you incorporate data found in a Numbers spreadsheet into a Pages documents.

A movie on the page describes the process from beginning to end but I can give you the gist.

You start by creating a Pages document that serves as the template for your merged documents. Feel free to insert real or fake names, addresses, phone numbers, email addresses, and so on for placeholder text. They’ll be replaced later with your merged data. If the Format pane isn’t present, click the Format button in Pages’ toolbar and click the More tab.

Now select the first placeholder entry and from Pages’ Format menu choose Advanced > Define As Placeholder Text. A Script Tag field will appear in the Text pane to the right. Into this field enter the name of your placeholder—FIRSTNAME, ADDRESS, PHONE, MATENAME, or whatever’s most appropriate. Repeat for each bit of text that you wish to use as a placeholder.

pages mail merge

Select placeholder text and assign a script tag to it.

You then launch Numbers and create a spreadsheet that includes columns for each entry. (The column header need not match the placeholder names you’ve created.) Now select all the rows that contain the data you want to merge.

numbers mail merge

In Numbers, create a spreadsheet that includes the data you want to merge.

Launch the Pages Data Merge app and walk through the numbered steps. In the area marked with a 1, choose Selection of Numbers Table from the pop-up menu and click the Import button. When you do, the information from the first column in the Numbers document will appear in the Data Record Items area.

Select the first item in the list (in my example you’d select Frank). Click on the pop-up menu next to the second step and you’ll see a list of all the placeholders you’ve created in the Pages document. Select the one associated with the entry you highlighted in step 1 (in the example you’d choose FIRSTNAME). When you make a selection in the second step, its name appears under the Assigned Placeholder Tags heading in the first step. Repeat for each entry in the list.

pages data merge

The Pages Data Merge app.

In step 5 you can choose to email a copy of your merged document to your recipients. In order for this to work you must create a list of email addresses for your recipients in your Numbers document (having an email placeholder in the Pages document isn’t necessary). If you intend to email the results of your work, select the email address that appears in the list under step 1 and, from step 2’s pop-up menu, choose Assign As Email Recipient Address. The letter M will appear to the right of the selected email address indicating that the addresses in this column will be used as the To address in your messages.

It’s also within step 2’s pop-up menu that you can choose how your merged documents will be named. By default they’re assigned with the Pages’ document name followed by a number—Unsolicited Pitch-1, Unsolicited Pitch-2, and so on. But you can change that. Select the name of the recipient under the first step and then choose Assign For Use With File Naming from this pop-up menu. When you do, the name of the document will still appear first, but it will be followed by the data in the selected field—Unsolicited Pitch-Frank and Unsolicited Pitch-Doris, for instance.

In step 3 you choose the export file format—whether you’ll produce a Pages, Word (encrypted or not), PDF (encrypted or not), ePub, or unfomatted text document for each merged file.

Click Choose Export Folder in step 4 and select a destination for your merged copies. A Pages Data Merge folder that holds your merged documents will be created in this location.

And finally to the optional step 5. If, as I mentioned, you wish to email copies of your merged documents, enable the Attach option and enter a subject heading and message. As promised, a copy of your merged file will be sent to the addresses of those in your Numbers document.

Finally, click Begin. After you confirm that you wish to generate your merged files Pages Data Merge will set about creating and exporting the copies you requested.

Have a question of your own? Drop a line to mac911@macworld.com.

To comment on this article and other Macworld content, visit our Facebook page or our Twitter feed.
Shop Tech Products at Amazon
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.