Data Scraping not fetching complete data

Hi Guys,

I am trying to read the unread mails in gmail using data scrapping. I was able to get complete data from mail while using data scraping, for example the whole body of the mail even when not visible, but a week later when I’m trying the same it’s giving me only the visible data that’s scraped.
Can you please let me know where exactly the issue is?

Hello @bT_de
I can’t tell you why the aforementioned error is occurring :smile:, but you can try more reliably

In UiPath you can use get text activity and store the value as string variable and use write range based on values you want to insert.

Here’s just one example so you can understand it better.

using Build Data Table create a table (From,Company,Telephone,MessageBody)

  • Use Get IMAP Mail Messages Activities, and get unread mails
  • Use For Each Activity and get Body data -> strMailContent
  • Use Matches activity to get the all the details

From Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=From:).*(?=Company:))
Result: iEnumResult -> IEnumberable<Match>
after that use assign activity to get the data
strFrom =iEnumResult (0).ToString()

Company Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=Company:).*(?=Telephone:))
Result: iEnumResult -> IEnumberable<Match>
after that use assign activity to get the data
strCompany =iEnumResult (0).ToString()

Telephone Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=Telephone:).*(?=Message Body:))
Result: iEnumResult -> IEnumberable<Match>
after that use assign activity to get the data
strTelephone =iEnumResult (0).ToString()

MailBody Value:
Use Matches activity
Properties
Input : strMailContent
Pattern : ((?<=Message Body:).*)
Result: iEnumResult -> IEnumberable<Match>
after that use assign activity to get the data
strMailBody =iEnumResult (0).ToString()

Now you got the values into datarow.
using write range activity write the data in the excel file.

an example of activity collecting email data, I hope it helps you a little

2 Likes

Dear @KMota

Firstly I would like to thank you for such a clear example.
But the problem here is

  1. we aren’t allowed with the IMAP enabling in chrome across the organizations.
  2. we can’t even use the google api’s as the GCP services are disabled.

The only option i could think of is to data scrape the unread mails fetch the body of the mail and copy to excel.
I could see that the results aren’t stable.

I hope you understand my problem more clearly now.! :grinning: