Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 2, 2013, 11:07 AM   #1
paulCC
macrumors member
 
Join Date: Nov 2012
IMAP tool to export list of emails to Excel/CSV ?

I know this is not exactly an Mac-app question, but I do work on a Macbook, and these forums are full of knowledgable people.....

I have collected too many emails in Gmail, and would like to clean it up. I have deleted most of the emails form the various companies I purchased from over the years, but there is still some 25000 messages. ( which I believe is a wrong count, since a recent POP3 backup created 60000 messages..... ).

What I am looking for is an IMAP tool or email client, which allows the info on email headers/subjects/addresses to be exported to CSV, XML or Excel files, so I can look for the remaining "clutterers" in my Gmail - sort by the "From" address, create a histogram, etc.

Thanks for any info. PaulCC
paulCC is offline   0 Reply With Quote
Old Apr 3, 2013, 10:00 AM   #2
prisstratton
macrumors regular
 
Join Date: Dec 2011
Location: Winnipeg
Quote:
Originally Posted by paulCC View Post
I know this is not exactly an Mac-app question, but I do work on a Macbook, and these forums are full of knowledgable people.....

I have collected too many emails in Gmail, and would like to clean it up. I have deleted most of the emails form the various companies I purchased from over the years, but there is still some 25000 messages. ( which I believe is a wrong count, since a recent POP3 backup created 60000 messages..... ).

What I am looking for is an IMAP tool or email client, which allows the info on email headers/subjects/addresses to be exported to CSV, XML or Excel files, so I can look for the remaining "clutterers" in my Gmail - sort by the "From" address, create a histogram, etc.

Thanks for any info. PaulCC
The AppleScript below should do what you want. Copy and paste the code into your AppleScript Editor and hit Run. It will export all the emails from the account you specify (using the From and Subject fields) directly into an Excel spreadsheet. You will need to modify line 11 (mailbox/account) to reflect your account settings. I ran the script on a couple of different mailboxes on my system and it worked fine. It does assume that you have MS-Excel installed on your system.

I cannot claim this code, I found it here:

https://discussions.apple.com/thread...art=0&tstart=0

I did modify line 11, but I am no expert at this (just learning), so if you want something a little more fancy, others may need to jump in and help.

tell 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
# change the next line to reflect your settings……….….here………………and...here
set theMessages to every message in the mailbox "INBOX" of account "Gmail"
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(theSender, theRow, theSheet)
tell application "Microsoft Excel"
set theRange to "A" & theRow
set formula of (range theRange) of theSheet to theSender
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
__________________
 17" 2011 MacBook Pro, 2.3 GHz i7 Quad, 16GB DDR3, Intel 520 240GB SSD
prisstratton is offline   0 Reply With Quote
Old Jun 4, 2013, 02:01 PM   #3
hdas202
macrumors newbie
 
Join Date: Jun 2013
Export Gmail messages to CSV

You can do this without using any 3rd party software. Simply using Google Docs.

I have created a Google Script which will do the task for you. I have created 4 versions of the script. You can even export attachments to Excel.

Just visit Export Gmail Messages to Excel or CSV
hdas202 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:15 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC