Skip to content

Instantly share code, notes, and snippets.

@trych
Last active July 26, 2019 09:38
Show Gist options
  • Save trych/337c8b754baa6612093dc68382c89232 to your computer and use it in GitHub Desktop.
Save trych/337c8b754baa6612093dc68382c89232 to your computer and use it in GitHub Desktop.
Exports all "From" addresses of a specific email inbox to Numbers for further processing. Duplicates are still present and need to be removed in the spreadsheet app.
tell application "Numbers"
set LinkRemoval to make new document
set theSheet to active sheet of LinkRemoval
tell table 1 of theSheet
set the value of cell 1 of column "A" to "From"
end tell
end tell
tell application "Mail"
set theRow to 2
set theMessages to messages of mailbox "INBOX" of account "Name of account"
repeat with aMessage in theMessages
my SetFrom(extract address from sender of aMessage, theRow)
set theRow to theRow + 1
end repeat
end tell
on SetFrom(theSender, theRow)
tell application "Numbers"
tell table 1 of sheet 1 of document 1
set the value of cell theRow of column "A" to theSender
add row below the last row
end tell
end tell
end SetFrom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment