How to get the specific columns of a respective row data for every iteration in each respective mail to outlook body

Suppose i have 12 columns in excel, i want only 6 columns row data.
o/p as: in outlook body - Hi, Please see the attachment. here i want to get the respective row data of each mail from excel(datatable) of only 6 columns.
I tried in these ways…

  1. str_input = dt.Rows(rowindex)(columnindex).ToString
    I dont know how this variable can be used in the mail body in SEND OUTLOOK MAIL activity
    2)got entire datatable in html format
    Please help me out this!

Hi @pallavi121222 welcome to community

Can you elaborate your question with an example?

I have 12 columns & 20 rows in excel.last column has status as either success or failure.
for every success mail has to be sent. In outlook mail body along with HI, Please see attachment. here i have to print respective success status rows data of only middle 6 columns. which means i get only one row data( 6 columns 1 row). in body of outlook.

Well, If I understand your requirement correctly here are the steps you can take…

  1. Filter data table using the status column as ‘success’
  2. For each row in the filtered data table
    3.Send outlook mail activity with predefined mail body with replaceable keywords for your row text to be injected.
  3. The string that is to be replaced you can replace it with row(x) + row(x+1) + row(x+2)+ row(x+3)+ row(x+4)+ row(x+5)
  4. Repeat

Hope this helps :slight_smile:

Thanks for your support!
i didnt get you-3rd point!
here is the output i am getting

but i want only one respective row to be pasted in outlook body.


Row of (x) means the row index or the column name anything is fine you have done it correctly except that I surmise you forgot to put the for each row loop so you are getting the same email in the table. Have you used the loop? If so do you have unique values in it?

Maybe looking at your sample workflow might help… Do you reckon you can share your xaml?


Hi, I have used for each row activity.and placed the above code inside it.
Please kindly see Main.xaml (21.3 KB) xaml file.
let me know the way to sort it out.


I perused through your code… I didnt understand a few parts where you are incrementing the row index by 2…

Then i see you have a HTML that is the body of the email that you want to send. Why not have a keyword like (#rowdata#) or something in those line that will replace the six columns in your mail body in real time.

So basically your html string will have #rowdata# and it will be replaced by row(name) and row(,subject) and so on until you have all your 6 columns.

Hi @pallavi121222

Below is the thread i have recently shared few hrs before which will solve your issue :-

I got the issue you are facing so for that you should try the method that i have used in the above thread workflow

I get the output in the following form by the above workflow i shared :-

Where the 6 column values for that particular row where Column9 have status “Success” in your workflow are equivalent to my UserName, Email ID and Mobile No in my workflow

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Thank you so much for your continuous support!!
Issue resolved.

Thanks for Sharing the file.I Could able to know new things.

Hi @pallavi121222

If you use the way that i have done then may you will get the output you are expecting

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer: