Delete row tooks lot of time with Insert/delete activity

Need to delete 50000 rows and let the headers and the first row but it tooks lot of time

@Soudios

Are you deleting on any condition based? then use Filter Datatable instead of Delete row

Hope this may help you

Thanks

I need to let the first row, and delete all the rest. The rows are different

@Soudios

So you need only first row to keep and remove all remaining rows

Check below for your reference

In Assign DT1 = DT1.AsEnumerable().Take(1).CopyToDataTable

above expression will keep only 1 row in the datatable

Hope this may help you

Thanks

@Srini84

i have different column (30) and different row (50000) and the excel file is not every time the same. I need something that works for every excel file i have

@Soudios

Copy to datatable and after that you can use write range activity to write back to excel, this will work

Thanks

@Srini84

Do you have an example plz ?

@Soudios

As i shown you in the above screenshot, Instead of build datatable use ReadRange activity to read your excel after that Assign, once you done that use write range activity to write back to the excel

Try this way and let me know where you are facing issue

Hope this may help you

Thanks

Instead of “Insert/delete rows” activity, use “Delete Range” activity with ShiftOption as ‘EntireRow’