Insert/delete rows activity


How to use activity insert/delete rows?
I want to delete specific rows in excel.
For example: I want to delete all rows which containts “xxx” in column B.

Thank you for help

you would need to calculate the indexes / row positions

is the Data from the excel already present in a datatable e.g. done with a read range?

I need to delete rows directly in excel. How to find the positions of all the rows with specific text?

on this we guide you, but therefore we did ask the question from above

No. And I can’t transfer to a database because it will mess up my proper formatting in excel.

I meant that I can’t move it to the database and filter it there and put it back in excel because it will mess up my formatting.

were talking about datatable not databases

in general we would do:

*Excel read range - as we dont overwrite the original excel we can do it for the index calculations

  • calculating the indexes e.g. Done with a LINQ statement
  • ordering the calculated indexes descending
  • for each loop on the ordered indexes
    • using the current loop index for the deletion along with the offset e.g. AdddHeaders was used for the read range

A LINQ for getting the indexes (already ordered) would look like this used within an assign activity

arrPositions - Int32() - an Int array
arrPositions =

(From i In Enumerable.Range(0, yourDataTAbleVar.Rows.Count)
Let v = yourDataTAbleVar.Rows(i)("YourColNameOrIndex").toString
Where v.Contains("xxx")
Order By i Descending
Select x = i).toArray

when arrPositions.Length = 0 then there is nothing to delete

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.