Is there a way to create address labels using data from a Numbers document?

I'd like to print mailing labels for holiday cards and my wife created the list in a Numbers spreadsheet.
Is there any way to export to Pages or some other label printing application?


Thanks.

Mac Pro 2.66GHz 4C Nehalem, Mac OS X (10.6.2), 23" Cinema HD Display

Posted on Dec 16, 2014 10:46 PM

Reply
13 replies

Dec 16, 2014 11:36 PM in response to buttermaker

Hi Buttermaker,


The Mac OS Contacts application lets you print out addresses in Avery label format. It might be possible to export the spreadsheet to Contacts using an AppleScript, but we would need to know how the list is constructed in Numbers - a screenshot of some "dummy" names and addresses would help.


Cheers,


H

Dec 16, 2014 11:43 PM in response to HD

But.... I don't want all of these addresses in my contacts.


The Spreadsheet is very straightforward.

Four columns labeled First, Last, Address1 and Address 2


I've just been experimenting with no success at using Pages' Mail Merge functionality.
When I chose my Numbers doc, I get "Please select a Numbers document that has one or more named header columns and one or more rows of data." - Which doesn't make any sense, because why would I need a "header column"?
I have a header row (which is selected as such) across the top, like most people organize their spreadsheets.

Dec 17, 2014 1:54 AM in response to buttermaker

Buttermaker,


That instruction was poorly written. You are correct about that type of table you need in your Numbers merge document. The popup instruction is:


Please select a Numbers document that has one or more named header columns and one or more rows of data.


A better wording may have been:


Please select a Numbers document that has one or more columns with named headers and one or more rows of data.


Jerry

Dec 17, 2014 3:45 AM in response to buttermaker

The solution I envisaged would create a Group within Contacts whose members could be easily identified and deleted. Alternatively, if your wife had her own user account on your Mac, then she could run the script and create her own contacts list which could be used in subsequent years without bunging up your contacts. The offer stands, your call...

Dec 17, 2014 8:52 AM in response to buttermaker

Righty-ho. This is based on a spreadsheet like this with named columns in Numbers 3.5. (The rows must be consecutive - the script moves on as soon as it sees an empty row):

User uploaded file


With the spreadsheet open, run the following AppleScript. It will create a group called Christmas List in Contacts, and then import the name and address data from the spreadsheet, adding each person to the group:


tell application "Numbers" to tell front document to tell active sheet to tell table 1

set all_contacts to {}

set row_count to count rows

repeat with each_row from 2 to row_count

set nu_contact to {}

set first_name to value of cell each_row of column "First"

if first_name is missing value then exit repeat

copy first_name to end of nu_contact

copy (value of cell each_row of column "Last") to end of nu_contact

copy (value of cell each_row of column "Address1") to end of nu_contact

copy (value of cell each_row of column "Address2") to end of nu_contact

copy nu_contact to end of all_contacts

end repeat

end tell



tell application "Contacts"

set group_exists to (every group whose name is "Christmas List")

if the result is {} then


makenewgroupat end of groups

set name of the result to "Christmas List"


save

end if

repeat with each_contact in all_contacts


activate

set nu_person to (makenewpersonwith properties {first name:item 1 of each_contact, last name:item 2 of each_contact})


save


makenewaddressat end of addresses of nu_personwith properties {street:item 3 of each_contact, city:item 4 of each_contact}


save

add nu_person to group "Christmas List"


save

end repeat


end tell

Contacts will look like this:


User uploaded file


With the Christmas List group selected in Contacts, go to the Print menu and choose the label format you want:


User uploaded file


Once the labels are printed, select all the names in the Christmas List Group and press the delete key:


User uploaded file


Click the middle "Delete" button and the contacts will be gone.You can then delete the Christmas List group itself.


This can also be done in Numbers 09, but the script would have to be modified slightly.


Hope it helps,


H

Dec 17, 2014 9:47 AM in response to buttermaker

Ooops sorry.


In Finder, open your Applications folder, then the Utilities folder that's inside. (The Finder keyboard shortcut for the Utilities folder is Cmd+Shift+U)


Inside that you should find Script Editor (called AppleScript Editor in some versions of OSX):


User uploaded file


Double-click on it to launch it, then press Cmd-N to create a new script window:


User uploaded file




Copy and paste the entire contents of my script into the script window.


Click the Hammer button to "compile" the script - it should become indented and coloured, a bit like this:


User uploaded file



Click the triangular Run button to run the script. (Just to be on the safe side, make sure you've saved the spreadsheet first!)


Hope this helps,


H

Dec 17, 2014 10:59 AM in response to buttermaker

buttermaker wrote:


If we can get the data into contacts and then out after, I'm all ears.

A simple way to temporarily use Contacts to Merge and then lose the cards is to Log in as Guest. Your Guest account will have no contact data when you enter, and will not remember a thing after you log back out. You would have to load your Numbers contact data from an external device.


Jerry

May 7, 2015 2:12 PM in response to HD

HD-your method worked for me, but I have a bit of different layout and changed your script to create a "Birddog List"... Here's what I did:

User uploaded file


User uploaded file


User uploaded file


As you can see, it did not place the information into my contacts as I had hoped (and subsequently, they don't line up in my printer's Avery mailing label format properly). Can you offer any suggestions about what I did wrong? I'd like it to insert into the label like this (using my spreadsheet header titles):

Name

Addy

City, State, Zip


BTW, thank you for going to the trouble of documenting how to do this!!! It's my first foray into scripts, and although I don't necessarily understand the language, it's getting me to dip my toes into it by cutting and pasting--if improperly lol. It isn't that hard--when someone can provide the code!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Is there a way to create address labels using data from a Numbers document?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.