How to extract email from email table and then write to excel

Hi guy i needed some help
currently i am stuck to extract information from my email

I would like to extract this table from my email but i currently i am stuck at how to extract the table out ?

I have attached the msg file in the test.zip

Name of School xx
Name of FP yy
Type of Query aa
Date In
Query Question bb
Query Solution cc

I have done like this

I have attached an email msg for reference
test.zip (31.8 KB)

@xxGoRpa

Get the html body from the emil variable…email.BodyAsHTML

Then save the string value to a text file with .html extension

Then use a use application/browser activity and open the created file…then use extract table by indicating the table and get the table into a datatable

Hope this helps

Cheers

Hi @xxGoRpa

After saving the email messages in .msg format you can follow below process to extract that data to excel.
Make sure to indicate the already opened msg file or pass the Outlook exe application path in Use Application/Browser.



xaml:
Sequence15.xaml (12.4 KB)

Regards

what happen if is not in test.msg ?
it be just in the email ?

does this mean i need to save each email out ??

Hi @xxGoRpa

You need to save the email out with a name and do the process.

Regards

@xxGoRpa

You need to save the html body of the email but not the email…once read you can delete the file

Cheers

i see how can i do it ?
any example i can follow ?

any example i can follow ?

@xxGoRpa

Do you have any specific that you will receive these many number of emails. According to that I will help you with flow.

Regards

There no specific number but from what i ask
It be using the same table format send to email
Then

The result be like this

@xxGoRpa

Do you have the count of emails that you receive.

Regards

@xxGoRpa

Just follow the above 3 steps…

  1. extract html body
  2. Save .html file
  3. Open and Extract table

Are you facing any issue trying this?

Cheers

yes i need to think about it how to do


<Assign Name="htmlBody" Value="[item.Body.ToString()]" />
<Assign Name="htmlFilePath" Value="[Path.Combine(Environment.CurrentDirectory, 'email_body.html')]" />
<WriteText File="[htmlFilePath]" Text="[htmlBody]" Overwrite="True" />

i feel like is wrong with the htmlfilepath ?

@xxGoRpa

May I know what is the above one?

Cheers

i manged to do it by
save it to an .mht

then from mht use data extraction to extract the table
now i got is like this

Name of School xx
Name of FP yy
Type of Query aa
Date In
Query Question bb
Query Solution cc

is there a way where i wil lcreate my own excel
with the header
then it paste it into A2 as an row ?

@xxGoRpa

You can change the headers from the code if you need…or you can have a template excel with pre populated heqder and then in write range uncheck add headers and write from A2

Cheers

Hi i did that however i got

Name of School xx
Name of FP yy
Type of Query aa
Date In
Query Question bb
Query Solution cc
Still

@xxGoRpa

Is something wrong?

I dint get what is wrong

Cheers