How to write the contents of excel into email message body without loosing table formats

Hi folks,

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.

  1. Read the excel file and stored in datatable output
  2. Used output datatable activity and stored the output into string variable
  3. Used this string varaible into email message body but I see the format of the table will go with this approach.

Thanks,
Vishal Kumar

2 Likes

Hey there,
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.

Or
If Your just looking for tabular structure data here is a best example.

1 Like

Hey Vishal,

were you able to achieve the formatting portion? Do share your thoughts and solution.

Thanks

1 Like

Hey Joshikumarav,

I have constructed a html file and I am passing this to email body and I could get the table format

Thanks,
Vishal Kumar

1 Like

Hi Vishal,
Can you share the file in which u have executed this. I want it for reference

1 Like

Hi @suda_amir,

Please find the attached workflow for reference.

Thanks,
Vishal KumarHtmlTableBodyinEmail.zip (12.9 KB)

2 Likes

Thanks bro. I have seen your code. My table is quite complex to be done this way

1 Like

Hi@suda_amir,

Could you share the sample table in a excel file.

Thanks,
Vishal Kumar

1 Like

Hi @vishal.kumar

Image of the Excel table

Everything is dynamic in this table(including colours)

2 Likes

Hello You can download package and use exceldata activity.

1 Like

Download and install package, use exceldata to htmlstr (with formats) activity.

1 Like

Can u send me a working sample of it?

1 Like

Visit AtrimalActivitiesPack
Forum page

1 Like

Got You. Yay!!!

1 Like

Hii
I want to copy and paste the pivot table from excel to email Body.
how to do that?

1 Like

You can also try the below method to paste excel data in outlook mail body.

2 Likes

Hi @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.

image

1 Like

@veselim

Can Do! use “vbCrLf”

image

image

1 Like

@Mr_Meeseeks

Do you have IsBodyHtml checked?

image
I need this checked for the excel table to properly show up in the email.

image

1 Like

@veselim

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!)

image

image

1 Like