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)