Deleting Specific Rows in Excel

Hi all,

i want to delete some specific rows in Excel document but i don’t think i can use data filter because rows variables changing all the time.
Ex : Lets say, we have 8 row in A_Column and our datas
AA
BB
CC
DD

and i do not want to delete BB and DD row or more
How can i do that?
Thanks.

how do you know which rows to delete?
is there a condition?

First of all, i did data scraping and sent to excel, but some datas, i do not want to see and delete from in excel row.
For now, i know which row should i delete but in the future it will be change.

Hi @yigit.aybey ,

As a First Try, Do always Check if a Datatable Operation might help you in retrieving your Needed result.

You Could read the Excel Sheet as a Datatable using Workbook Read Range Activities, then Perform Filter Operation using Filter Datatable Activity.

You Could then write this Filtered datatable into a new Sheet.

Filter Datatable Configuration :
image

Are you working with REFramework?

if you know which row variables are relevant you could put the values in config file (in folder Data), for example:
Name | Value
KeepRowValue | BB,DD

  1. You could use “BB,DD” and set comma as a delimiter (String.Split function). Then you have a string array.

  2. Now you iterate over the string array.
    With a for each you can check if the correct row is in your data and if the correct row is found, you add the index of the row to the list of integer.

  3. Then you iterate over the list of integer and delete the undesired rows.

Note:
Alternatively you can use multiple LINQ-statements, which is faster and much cleaner.

Firts of all,
thank for your help @supermanPunch and @Smars.
I tried datafilter and it did work. i found a mistake of while reading datas. In datafilter it cannot read the empty space like(Word1 Word2) so i have to join these two words.
@Smars Right now, i’m not working with ReFramework structure but thanks for info.

@yigit.aybey ,

Could you explain in a bit more detail the Operation that you want to perform ?