Copying entire Mail message content into Excel using Applescript
I am using the code below to try and automate the copying of entire emails from my Mail app to an excel document. The code works fine, but all of the email messages are truncated to a limit of 256 characters. I presume it has something to do with the line " my SetMessage(content of aMessage, theRow, theSheet)". Does anyone know how to fix this so that the entire email message is copied over?
tell application "Microsoft Excel"
set LinkRemoval to makenewworkbook
set theSheet to active sheet of LinkRemoval
set formula of range "D1" of theSheet to "Message"
set formula of range "C1" of theSheet to "Subject"
set formula of range "B1" of theSheet to "From"
set formula of range "A1" of theSheet to "Date"
end tell
tell application "Mail"
set theRow to 2
set theAccount to "Google"
get accounttheAccount
set theMessages to messages of inbox
repeat with aMessage in theMessages
my SetDate(date received of aMessage, theRow, theSheet)
my SetFrom(sender of aMessage, theRow, theSheet)
my SetSubject(subject of aMessage, theRow, theSheet)
my SetMessage(content of aMessage, theRow, theSheet)
set theRow to theRow + 1
end repeat
end tell
on SetDate(theDate, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "A" & theRow
set formula of rangetheRange of theSheet to theDate
end tell
end SetDate
on SetFrom(theSender, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "B" & theRow
set formula of rangetheRange of theSheet to theSender
end tell
end SetFrom
on SetSubject(theSubject, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "C" & theRow
set formula of rangetheRange of theSheet to theSubject
end tell
end SetSubject
on SetMessage(theMessage, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "D" & theRow
set formula of rangetheRange of theSheet to theMessage
end tell
end SetMessage
MacBook Pro (Retina, 13-inch, Late 2013), OS X Yosemite (10.10.2)