i would like to delete rows with ranange “n1-n2” how can i do this?
Hey @Rowley101, You can use delete range activity and provide the input lets say “A1:B7”
Hope this will help!
i wanted to do it for a datatable, not in excel. using remove datatable activity
If you’re deleting from excel, use the above solution.
If it is a DT with another source in the workflow, there are several options:
- Loop through your DT and determine if the row that’s been presented is an applicant for deletion baserd on either content or an index # if that is applicable
- use filter datatable to remove them, if you can describe your range by a condition
- if you simply know that you need to remove row number n1 to n2, make a loop that runs from n1 to n2 and call the ‘remove data row’ activity, passing the n value as index.
Hi @Rowley101
You can use invoke code activity using this syntax
Datatable_variable.Rows.RemoveAt(Index_of_the_row)
Fine if you know the number of rows to delete then we can try with skip or take method
Like this in a simple assign activity
dt = dt.AsEnumerable().Skip(20).CopyToDatatable()
Or with take method
dt = dt.AsEnumerable().Take(20).CopyToDatatable()
Skip will remove the mentioned number of records from the first row and gives the remaining
Take will give only the mentioned number of rows from DATATABLE
Cheers @Rowley101
in case of we want to take or from start we can use take or skip as mentioned by Palani
we also can chain it:
in case of we want to remove an inner range out of the datatable we can do work with concat or indexed Where LINQ: