Email data extraction

Hi All,

My requirement is as below:

  1. Find Gmail messages with Uber receipts
  2. Parse these emails and find addresses of the starting and the finishing points of Uber trips
  3. Save the $ amounts from Uber receipts, date + time, and starting and finishing points in Google Sheets
  4. Save emails with Uber receipts to Google Drive as PDFs

The first step is done. In second step, am not able to get the body of the mail since it has the information in a pdf format.

Please help me to extract the required information from the body of the email that is in the pdf format. Am attaching the sample body of the email below:

So help me to extract the amount and date mentioned in the right corner present inside a pdf format

Thanks in advance !

I just looked and my uber receipts do not have any PDF attachments, there are 2 inline picture attachments showing the route map, but no PDF.

What happens if you use write line to see the mailMessage.Body? Also do a write line for MailMessage.Headers(“HTMLBody”).ToString

It is possible that you need to extract the body from the headers instead since it has HTML in the body

Thanks Dave ! I tried displaying the body of the email in the output panel using write line activity as “mailmessage.body”. But the result that i got was fully in HTML language.
Also i tried your suggestion of using “MailMessage.Headers(“HTMLBody”).ToString”. Again the result that i got was in HTML language.

I have copied first few lines of my result below.

<!doctype html><!–[if !mso]><!–[if gte mso 9]>
<o:OfficeDocumentSettings>
.
.
.
.
.
.

etc.

The answer provided here (order is very important) should help reformat so the body is showing in plain text. I’d give that a try, then you should be able to use normal string manipulation techniques (e.g. regex, split, substring, etc) to get the values needed from the full text

2 Likes

Thanks Dave ! Will try this and let you know the result.

Hi @Hirunyaa,

Try to look at UIPATH.GSUITE.ACTIVITIES
It has activities for Google Sheet, Gmail, Google Drive etc.

Thanks,
Adhee