I have email as input for robot to be triggered. There is normal text as well as table included in the email body which I need to read for every trigger, some of the fields will be extracted from the email which will serve as input going further.
Please help me extract table from which I need data for a couple of columns.
Welcome to our Community!.
Try with this xaml, I have saved the mail as .mht format and opened in IE as webpage, then extracted the data from that table as we want. So this will be easy and clear without any string manipulation.
ReadMailExtract.xaml (9.4 KB)
You can read it as HTMLbody
Once you have HTML Body, you can either save that as html file using write text file with .html extension and then read use OPEN BROWSER activity to open it in browser and use DATASCRAPPING to get the table/
I don’t the there is straight forward way to extract the table from HTML.
If you find better way to extract table from HTML, please do post it here
actually sorry but my mail has no HTMLBody as headers, so its creating issue. I checked for item.IsBodyHTML, it turned out to be a no.
Can you check what it logs if you use item.Headers("HTMLBody).ToString
it throws "Compiler error(s) encountered processing expression “item.Body(“HTMLBody”).ToString”.
Option Strict On disallows implicit conversions from ‘String’ to ‘Integer’.
Please can you tell me how are you saving mail as .mhl format?
Also it is not opening in IE, instead its opening a huge long HTML code for the same. But that file is able to open in excel.
Please can anyone tell me more about “Extract Data Tables From HTML” activity.
I need to have separate file for separate table or at least for separate mail.
welcome to uipath community
–if its not a html body then it must be a embeded image
–so once after getting the mailmessage list as output from GET OUTLOOK MAIL ACTIVITY, use FOR EACH loop and pass the output variable here as input
–inside the loop use SAVE MAIL MESSAGE activity where save the mails to a folder with .eml file extension
–then use START PROCESS and mention the .eml file path along with that folder path
–this will open the email in front end
–then we can use SCREEN SCRAPPING method and get the output with a variable of type string name str_input
–now use GENERATE DATATABLE activity and pass the str_input as input and get the output with a variable of type datatable named dt
–now from that datatable variable we can get the value we want using FOR EACH ROW loop
hope this would help you
thanks brother but this will go really complex just for reading a couple of columns from an email body. I am actually expecting to have more idea on the above mentioned activity. I am already getting the embedded tables out in workbooks, but the main concern is for each run it is creating a separate file while I actually need separate file for each table embedded inside somehow.
in that case save them as a excel file with filename as “filename”+"_"+now.ToString(“hh_mm_ss”)+".xlsx"
so that each time it will create a new workbook
–and also the datatable variable obtained must be cleared out and it has to be done at last in each loop with a CLEAR DATATABLE ACTIVITY where mention the datatable variable as input
okay thanks brother, will try this and discuss.
I have got the tables using ‘extract datatable from html’ activity, its a custom one. It will fetch me all the tables inside any email body. Also one thing you need to be clear about will be the background structuring of the email (its formatting) like where is table where is list or other items. As I had many embedded tables but was able to see only 2 of them so in that case you can ask the sender of email to work on this or you can provide a simpler template to them which will be as per ease to be read by bot.
Thanks guys for responding and guide me through this issue.
Custom activity to extract tables from email:
It takes mailmessage as an input and returns a dataset with all the table content in the email.
Hi @Palaniyappan, Im having a problem in the XML metadata section (still not too sure)
Please find attached my file:
Read_Outlook.xaml (15.2 KB)
Do let me know, what needs to be done, will be extremely grateful.
May I know what is the input format
tbh, i wont act as if I can distinguish one screen scraping activity from another.
Tried “screen scraping” too throws an error, tried converting .mht to .html doesnt work either.
Its super confusing, please help
May I know what is that error