I have a requirement where I need to read the data from excel and send that content in a email. How can I achieve this without loosing the table structures. Can somebody please help me on this.
Read the excel file and stored in datatable output
Used output datatable activity and stored the output into string variable
Used this string varaible into email message body but I see the format of the table will go with this approach.
If your looking to keep the format then best thing is to do is use Clipboard (copy and paste to outlook body from excel ) by Ui Automation.
If Your just looking for tabular structure data here is a best example.
were you able to achieve the formatting portion? Do share your thoughts and solution.
I have constructed a html file and I am passing this to email body and I could get the table format
Can you share the file in which u have executed this. I want it for reference
Please find the attached workflow for reference.
Vishal Kumar HtmlTableBodyinEmail.zip (12.9 KB)
Thanks bro. I have seen your code. My table is quite complex to be done this way
Could you share the sample table in a excel file.
Image of the Excel table
Everything is dynamic in this table(including colours)
Hello You can download package and use exceldata activity.
Download and install package, use exceldata to htmlstr (with formats) activity.
Can u send me a working sample of it?
I want to copy and paste the pivot table from excel to email Body.
how to do that?
You can also try the below method to paste excel data in outlook mail body.
I have used shell scripting to copy and paste excel data in outlook body.
This preserves the format as well. Steps to replicate the process is as follows:-
Step 1 - Open a notepad and paste the below code and save the file with .ps1 extension
$x1 = New-Object -comobject Excel.Application
$UserWorkBook = $x1.Workbooks.Open(" excel path")
$UserWorksheet = $UserWorkBook.Worksheets.Item(1)
@vishal.kumar , I am trying to send an email that includes a table as well as regular text. How can I add a new line within the body of the email? Usually with Environment.NewLine it will give you a new line, however, I cannot do this when IsBodyHtml is checked off. I want to include space between my text and the excel table but with IsBodyHtml checked it ignores Environment.NewLine within the body and the email is all compressed.
Do you have IsBodyHtml checked?
I need this checked for the excel table to properly show up in the email.
Can Do! when IsBodyHtml is checked we can use
br / directly in the string to add a new line. (if you try that in the forums with the brackets it actually works here too!)