Use write range activity to copy the data that meet the condition set in if statement

Dear all,

Good morning,

I would need help to use Use write range activity to copy the data that meet the condition set in if statement

Here is my workflow.
Main.xaml (12.2 KB)

Thank you.

Hi @eelin,

Please check this steps it will helps you.


  1. Use Read Range Activity(uncheck the checkbox(add headers)) - to read your file --> DT1
  2. Use Remove DataColoumn(if you have any additional columns) --> DT1(pic2)
  3. Use writeRange Activity - to append the data (uncheck the checkbox(add headers))
  4. use select query while using the Write Range

Query :- DT1.Select("[Column0] = ‘B9070000’").CopyToDataTable

I have follow your steps but it shows the error message below…

use this query only…
if you mentioned the column name it will through exception…
please follow exactly i mentioned above.

It is still the same

share your xaml file. i will check

Main(2).xaml (10.8 KB)

Looks this image and the shared XAML not same.
Can you share your excel Files as well

there is no issue in code.


Sorry for the late reply.

testingcopydata.xaml (10.9 KB)

Master file (sample).xlsx (181.0 KB)
PL Analysis-APR19-ITD (sample).xlsx (126.5 KB)

please find the xaml filestestingcopydata.xaml (12.3 KB)





Thanks for your help.

Now i am able to copy the data by using the filter data table and paste it into the worksheet.

But when i want to do for the another filter it cannot or says it will not have any effect.

Kindly advise me.

Thank you.
TESTcopydata.xaml (21 KB)


will check and let you know…

i tested you xaml file its working fine…
in your second filterdatatable you want to keep these items only (Travel) …

  1. B9160010
  2. B916MY01
  3. B916MY02

please check the excel sheet attached Master file (sample).xlsx (159.6 KB)


Thanks for your reply.

What i want to do is i want to keep those items and paste the data into sheet (Travel) in the master file same as what i did for the salary sheet.

But it will only paste the data for salary but not the travel as well…

Kindly advise me.

those records are exist in Travel Sheet right.
please check the uploaded excel

Hi @venkat4u

Iam new to RPA and trying to automate this excel task,

Task - i have to read the source file and copy the rows ending with (keyword) to new workbook in destination folder.

Can you please help.

Hi @Tiji_Johny,

you can use filterdatatable activity
and select the option Ends with.

Venky :slight_smile:

Thanks @venkat4u

i was able to use filterdatatable activity and filter row with ending keywords.

Sounds good.

you can mark this as solution.

SMA.xlsx (9.1 KB)

Hi @venkat4u

is it possible to group rows based on email id and copy to separate workbook?

The email ids i get each day is dynamic and i have to segregate rows based on email id and copy to separate workbooks.

Can you please help. i have attached an example workbook.