Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I Adjust This AppleScript to ONLY export email addresses to Excel

Hello,


I am a complete newb to AppleScript, but was able to Google a script that extracts emails from my Mail "Junk" folder and creates an Excel file:


application "Microsoft Excel"

set theSpamFile to make new workbook

set theSheet to active sheet of theSpamFile

set formula of range "B1" of theSheet to "Subject"

set formula of range "A1" of theSheet to "From"

end tell

tell application "Mail"

set theRow to 2

get mailboxes

set theMessages to messages of junk mailbox

repeat with aMessage in theMessages

my SetFrom(sender of aMessage, theRow, theSheet)

my SetSubject(subject of aMessage, theRow, theSheet)

set theRow to theRow + 1

end repeat

end tell


on SetFrom(theFrom, theRow, theSheet)

tell application "Microsoft Excel"

set theRange to "A" & theRow

set formula of (range theRange) of theSheet to theFrom

end tell

end SetFrom


on SetSubject(theSubject, theRow, theSheet)

tell application "Microsoft Excel"

set theRange to "B" & theRow

set formula of range theRange of theSheet to theSubject

end tell

end SetSubject


I would like to strip this script down to create an Excel file of ONLY email addresses (No names and no subject). I know it's something simple, but all my attempts have failed. Now I'm turning to you nice folks for help.

tell

MacBook Pro with Retina display, OS X Yosemite (10.10.5)

Posted on Aug 28, 2015 8:58 AM

There are no replies.

How do I Adjust This AppleScript to ONLY export email addresses to Excel

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