Data Merge with Pages and Numbers
Apr 6, 2019
Few weeks ago I had to print several letters, all of them containing pretty much the same text, except for the address header and few other details, like setting Mr. and Mrs. according to the gender of the recipient.
I could have changed the relevant parts by hand in each one of them, but while this wouldn't have taken much time, I wanted to automate it for 2 reasons:
- fear of making random mistakes,
- I lately get extremely annoyed when I need to make repetitive tasks on a computer.
I had already dealt with this issues in the past, as I used to need to send pdf's filled out differently to different people, and I was glad to see the recipe hadn't changed in all these years because of some macOS or Pages release.
Nor Pages nor Numbers support this feature natively, but luckily for us both applications are scriptable via Apple Script, and even more luckily, there is someone who has already done the work of figuring out how to do it.
MacOS X Automation, together with its corollary websites, is the home of many tutorials on how to use Apple Script and of few examples to use right away. Pages data merge is one of them, but you can find many others at iworkautomation.com.
To accomplish what I needed, I created a file in Numbers containing all the informations required, like name, surname, address, coupled with some bonus things like a field containing Mr. or Mrs. and words ending letters a or o since in Italian adjectives have a gender to them that must be in accordance to the person they refer to.
Few trials down the road, I had one pdf file for every letter I needed to print, correctly filled out.
Few last notes:
. the technique outlined here can be used, with minor differences, also to send out tailored emails. The app to download for Pages data merge has the option for emails too;
. as of this writing, when visiting iworkautomation.com there is a security advice from Safari warning the https certificate doesn't match the domain name. The website is safe, proceed without worries;
. as I was looking for resources to write this post, I found two other guys who had already dealt with the issue and are worth mentioning: Dan Moren at sixcolors.com and Chris Breen at macworld.com;
. on iworkautomation.com there is also a way to make a Mail merge using Contacts as the source for informations
* * *
If you like articles like this, please consider supporting this website through personal donations or sponsorships