antonioking
asked on
Extract data from emails and add to csv
I need to take some details from emails as they're received and add them to a csv file.
I think the best approach is to assign a script to an Outlook rule.
Please can someone assist me with this?
The email layout will always be the same, but the content will differ.
I need to extract the name from the 'To' address of the email and the 'Employee' and 'Reason' from the html table included in the body of the email...
Many thanks in advance!
I think the best approach is to assign a script to an Outlook rule.
Please can someone assist me with this?
The email layout will always be the same, but the content will differ.
I need to extract the name from the 'To' address of the email and the 'Employee' and 'Reason' from the html table included in the body of the email...
<table cellpadding="3" cellspacing="0" class="bm-data" width="100%">
<thead>
<th align="left">Employee</th>
<th align="left">Date</th>
<th align="left">Type</th>
<th align="left">Reason</th>
</thead>
<tbody>
<tr>
<td>Joe <strong>Bloggs</strong></td>
<td>21/04/2015, 9:13am</td>
<td>Went the extra mile</td>
<td>Fast response on IT issue, contacted me at 21:30 - going the extra mile! Cheers!</td>
</tr>
</tbody>
</table>
Many thanks in advance!
ASKER
Thanks OM Gang
The code you have supplied will return the value of the first cell of the table which is the 'employee' value
What about the 'Reason' and the name from the email's to address?
The code you have supplied will return the value of the first cell of the table which is the 'employee' value
What about the 'Reason' and the name from the email's to address?
Sorry, missed the part about getting the employee. The code above does retrieve the Reason though (it retrieves the LAST cell in the table). In your original Q you asked for the name from the To address. The Debug.Print olMsgItem.Sender retrieves the senders name if it can resolve it, e.g. in my environment working off of a corporate Exchange server it returns 'Gang, OM'. If you want the email address instead us olMsgItem.SenderEmailAddre ss.
I'll add code to retrieve the employee as well.
OM Gang
I'll add code to retrieve the employee as well.
OM Gang
ASKER
Thank you very much OM Gang!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've requested that this question be closed as follows:
Accepted answer: 500 points for omgang's comment #a40738281
for the following reason:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Accepted answer: 500 points for omgang's comment #a40738281
for the following reason:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
ASKER
Thanks
Apologies for delay in awarding points!
Apologies for delay in awarding points!
OM Gang
Open in new window