Macro to Copy Data from Outlook to Excel Spreadsheet

Status
Not open for further replies.

Akshay

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server 2007
Hi,

I have a report sent to my email on a daily basis. The report has various tables which can be sent in html format or plain text format. The structure is as follows:


Company: ABC
Top applications by usage

Application Usage % Usage
------------------------------------------------
1 Apple 1.00 GB 77.3%
2 Facebook 58.9 MB 4.4%
3 Miscellaneous secure web 51.4 MB 3.9%
4 Miscellaneous web 48.4 MB 3.6%
5 Instagram 26.5 MB 2.0%
6 Google Video 22.5 MB 1.7%
7 Gmail 20.3 MB 1.5%
8 CDNs 15.3 MB 1.2%
9 Google HTTPS 12.5 MB 0.9%
10 Google+ 10.5 MB 0.8%

I have various other tables like such in the report.

I want to essentially achieve this:

- Take the data from the email and copy it in a structured table into excel.

I have browsed around and people have used the regex code---which requires a known text to be searched for. I can't really search for a given string as these values in the table may change.
Really appreciate all the help.

Regards
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
There's no way around, you need to find any patterns. For instance, first split the text by vbcrlf into rows. Then split each row by the space character, where the first word is just a counter, the last one is the percentage, the two words before the last one are for the size, and everything else is the name.
 

Akshay

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server 2007
Thanks for the reply.

I found another way to do what I wanted. Essentially I made a simple macro to copy the data to a folder every time I received an email.

The data is saved in HTML format. Then, using the built in tool to extract data from the web in the data tab, I downloaded the tables into the file.

Cheers
 
Status
Not open for further replies.
Top