I created a workflow wherein bot reads the excel data and then created a loop for each row.
How could I:
Read the excel column and write sender’s name dynamically in “to” of “send outlook mail message” activity?
copy excel sheet header and a row in the outlook mail “body” and send to multiple users (each row to each user+ header which is common for all)
Please suggest some code which could convert the datatable to string such as its tabular format is not lost. Also, Screen scraping or copy is not working for that excel sheet.
Hi @igul,
Try this solution and change according to yours.
Just change the fields as per your column index and i have used outlook here. This is just a rough solution you can try exceptions and make the code more reliable.
How to:
Read the whole data to a data table using Read Range Activity.
Use For each row activity and read in loop.
Assign to variables the fields by row index.
Attach email app(outlook) then use selectors for the To,Subject and message fields.
Type Into and click on send.
Note: Just check the property Add Headers while using Read Range activity otherwise first the header will be coming.
Hi, @jibanjyoti: I actually started with that only. There are 3 challenges with this approach:
I have 17 columns and 15+ rows. I would need to add row(1) + row(2) +…row(17) in mail body
The tabular format of row added is not preserved
header row (common) also needs to be added in the body of each mail (15 rows of excel basically). As a workaround, I tried adding another activity “read row/ read range” to handle header row. But converting data table to string is not working
Could you please suggest an approach wherein I could preserve the tabular format of rows in mail body and add a header row to be sent to each recipient?
Also, I am using “send outlook mail message” activity to handle sending mails.
Thanks for sharing it.
It acted as a workaround but still did not preserve the table structure as is. Attached the screenshot (email.jpg) for reference. It got further distorted in case of excel sheet I am referring since the column width is larger in it.
Also, Currently, it is sending entire data to each recipient.
I updated the script referring yours. Could you please further build on it?
In summary, I need to send entire row 2+ header to recipient 1, row 3+ header to recipient 3 -----row 15 + header while retaining the table structure. Mail.zip (71.4 KB)
I have referred to the sequence attached in the reply 5d ago (which is on the similar lines as suggested by you). Only change I made is adding html tags
etc. in the assign activities (already added in the sequence). Finally, clicked on ishtml check box in send mail activity.
can someone please share a better example for this?
I want to add the html table within an outlook template. I can use the above code to derive the html table, but having issues while using it within the template.