Empty Email Body Using Gmail

How can I extract the Body from Gmail and Save into Excel Sheet ?

@anmita

You can use GSuite or Get IMAP Mail Message activity to retrieve mails from Gmail.

Hi @anmita

Please refer the thread

Extract Email Body - Help - UiPath Community Forum

Hope this helps,

Thanks.

Thanks @lakshman

But I am Facing issue only with extracting the Body. Am able to extract the Subject , etc

Regards
@anmita

Thanks @suraj.setty for the reference

Regards ,
@anmita

@anmita

Can you please show us the expression you are using here to extract the body of the email and show us any error message if you are getting.

Hi @anmita

lets say u are using Gmail Get IMAP
So just save all the messages in a list of mail messages and follow these steps:

  1. Iterate in mails using For Each loop.
  2. Use this type of condition in If block under For Each loop to select the particular mail from particular subject ( item.Subject.Contains(“ABC Text”) ). it will return the boolean.
  3. Based on the above boolean and save the body in variable using Assign activity to save the body you can use this syntax → item.Body.ToString
  4. After all these steps use can use write Range activity to save all the information in Excel.

Thanks

Thanks @nikhil.girish :smiley:

1 Like

No Problem :slight_smile: @anmita
Hope its working for you now if so kindly close topic
Happy automation

No Worries @anmita

Thanks.

Hi

I would like to suggest this thread as this refers similar to your scenario and it has got a workflow as a solution

Let us know if you are still facing any issue

Cheers @anmita

I tried following the approaches mentioned but they did not work.

So I am attaching the workflow that I followed.

Open for suggestion’s or if you could share the workflow that worked for you in extracting Email body using gmail.

Main - Copy.xaml (12.7 KB)

Regards,
@anmita

Thanks @Palaniyappan

@anmita Can you please let us know what is the error that you are getting. In prior follow these steps, and see where it is wrong

  • Within the for each, keep message boxes and try to print Mail date, subject, body etc and check if it is missing anything

No @ushu I am not getting any Error it just shows blank fields in Body. Other that that Subject, etc. I am able to Extract it.

Regards,
@anmita

Thanks for the reply @ushu

@anmita Can you try doing this

item.Headers("Plain Text")

Please follow the below link

https://www.youtube.com/watch?v=8aNOjjmxIyM

Hi @anmita ,

Looks like we have not yet done the first part of your Query.

Extracting the Body from Gmail account. After Checking your workflow, you have used item.Body for Retrieving the Body content.

We also would like to Suggest you to Check with the Below Expressions :

item.BodyAsHtml
item.Headers("HTMLBody")
item.Body

Also, To Check if the Body is an HTML, You can use the below :

item.IsBodyHtml

image

Hi @supermanPunch
I tried using the one’s you have mentioned but still it just shows blank in Body.

Thanks Arpan for the reply!!!