I want to get the table from an Excel and paste it in the same format in the email body.
How to copy the excel table and paste in email body
Hi
Please try the below steps to insert an Excel table into an email body:
-
Retrieve the worksheet values and store them in a Table variable. You can do this by using the Excel advanced Get multiple cells action. Enter the same session name you used in the Excel advanced Open action and select All rows from the drop-down list. Create a Table variable using the icon to the right of the Assign to variable drop-down list.
-
Instruct the bot to process the data row by row using the Loop action. Select the For each row in table iterator and select the same Table variable that you used in Get multiple cells. Create a Record variable using the icon to the right of the Assign to variable drop-down list. The Record variable holds all of the values for one row. With each iteration of the Loop, the bot retrieves the values of the next row and stores them in the Record variable, overwriting the values from the previous row.
-
Use the Email body field to select one of the following format options for the body of the email:
- Plain text: Use regular text in your email body, with no formatting effects, such as bold, italic, or underline, or special layout options.
- HTML design: Use HTML script in your mail body when you want your content to be displayed in a certain layout every time. You can also include interactive elements, such as links.
- HTML code: Use this option to create and customize your email layout and body. Use the editor toolbar to make various changes to your text, such as applying bold, italic, and other formatting effects, inserting links, and changing the font and size of the text. You can copy the content from the design editor and paste it in the Message field.
-
Enter the content you want to send along with the email in the Message field. The email will be appended to the message you have specified.
For more details, you can refer to this documentation.
Thank you.
![Collaborator Silver Badge](https://uploads-us-west-2.insided.com/automationanywhere-en/attachment/39d17670-cf25-4e5f-a570-cb74d0dadb49_thumb.png)
Hi
Please try the below steps to insert an Excel table into an email body:
-
Retrieve the worksheet values and store them in a Table variable. You can do this by using the Excel advanced Get multiple cells action. Enter the same session name you used in the Excel advanced Open action and select All rows from the drop-down list. Create a Table variable using the icon to the right of the Assign to variable drop-down list.
-
Instruct the bot to process the data row by row using the Loop action. Select the For each row in table iterator and select the same Table variable that you used in Get multiple cells. Create a Record variable using the icon to the right of the Assign to variable drop-down list. The Record variable holds all of the values for one row. With each iteration of the Loop, the bot retrieves the values of the next row and stores them in the Record variable, overwriting the values from the previous row.
-
Use the Email body field to select one of the following format options for the body of the email:
- Plain text: Use regular text in your email body, with no formatting effects, such as bold, italic, or underline, or special layout options.
- HTML design: Use HTML script in your mail body when you want your content to be displayed in a certain layout every time. You can also include interactive elements, such as links.
- HTML code: Use this option to create and customize your email layout and body. Use the editor toolbar to make various changes to your text, such as applying bold, italic, and other formatting effects, inserting links, and changing the font and size of the text. You can copy the content from the design editor and paste it in the Message field.
-
Enter the content you want to send along with the email in the Message field. The email will be appended to the message you have specified.
For more details, you can refer to this documentation.
Thank you.
But in this way it can't get the table headers, I need the headers as well in the email body.
Hi
You can uncheck the sheet contains header and then read the excel to get the headers.
![Collaborator Silver Badge](https://uploads-us-west-2.insided.com/automationanywhere-en/attachment/39d17670-cf25-4e5f-a570-cb74d0dadb49_thumb.png)
Hi
You can uncheck the sheet contains header and then read the excel to get the headers.
Still not getting the headers and it throws an exception.
Hi
You can uncheck the sheet contains header and then read the excel to get the headers.
Still not getting the headers and it throws an exception.
Can you please share the logic and exception that you are getting
![Collaborator Silver Badge](https://uploads-us-west-2.insided.com/automationanywhere-en/attachment/39d17670-cf25-4e5f-a570-cb74d0dadb49_thumb.png)
Hi
You can uncheck the sheet contains header and then read the excel to get the headers.
Still not getting the headers and it throws an exception.
Can you please share the logic and exception that you are getting
I have unchecked the “contains header” option but it throws me an exception. In catch option, i have set a msg box when I run the bot it opens the from catch. attached image is for reference
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.