How to remove duplicate rows based on Keyword and Retain other Duplicate rows

Hi,All

i want remove duplicate row based on keywords or particular string value
i’ve to retain the first one then remove the rest

column1 | column2 | column3
abc | abc | 123
123 | abc | 456
123 | abc | 456
abc | abc | 123
abc | abc | 123
abc | abc | 123

so my output should be
column1 | column2 | column3
abc | abc | 123
123 | abc | 456
123 | abc | 456

1 Like

You can use remove duplicate rows activity, to remove the duplicate row…

i dont want to remove other duplicate rows i just want particular string or row to remove

1 Like

@Palaniyappan

Kindly elaborate this pls i mean the conditoin buddy
based on what keyword here the output you have mentioned is obtained

but this can be usually done with REMOVE DUPLICATE ROWS activity

as it would retain the first occurence and remove the rest

Cheers @Pradeep_Shiv

1 Like

i want delete duplicate rows,but for only on particular string in excel, i’ve other data’s in excel which are multiple times which i dont want to delete if i use REMOVE DUPLICATE ROWS this is what it’s going to happen…

i’ve to check particular STRING in a row and ive to keep the first one and delete the ENTIRE ROW coming values which matches the same STRING

Fine
hope i got it
–if we have the datatable ready named as dt and build similar kind of data structure with build datatable activity with similar kind of column structure and get the output with a variable of type datatable named finaldt
–use a for each row loop and pass the datatable dt as input
–inside the loop use IF condition like this
stringvariable.ToString.Equals(row(“yourcolumnname”).ToString) and counter < 0
where counter is a variable of type int32 with default value as 0 defined in the variable panel
–if this condition passes it will go to THEN part where we can use a ADD DATAROW Activity where the arrayrow property can be mentioned as row.ItemArray and in the datatable mention as finaldt
–followed by this add datarow activity within THEN part use a ASSIGN activity like this
counter = counter + 1
or if the above condition fails it will go to ELSE part where again use a ADD DATAROW Activity where the arrayrow property can be mentioned as row.ItemArray and in the datatable mention as finaldt

then we can use this finaldt as input to the WRITE RANGE activity and mention the add headers property as enabled in the property panel
Cheers @Pradeep_Shiv

2 Likes

See the below workflow,
Sequence16.xaml (18.2 KB)

Happy Automation.

This was the error when i do it in my excel

Source: Invoke Method

Message: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index