Delete Rows in Excel 1st selected rows

Hi - I need help in below scenario. I have to delete rows from Excel sheet let say first 5 rows which is highlighted. Insert/Delete rows activity is not provided in my Studio version.

image

After you have your data table, you can remove the rows with code like this:
DataTable firstFiveRows = _datatable.AsEnumerable().Skip(5).CopyToDataTable()

2 Likes

@bcorrea

Is it possible without using Datatable?

@bcorrea

What I have observed is It is deleted first 4 rows but not deleting last 4 rows so it is becoing duplicate. See highlighted.

image

@bcorrea

I have used below code.

1 Like

@bcorrea

Because I need to use same sheet.

@bcorrea

Please let me know if you see anything. skip(4) is able to delete first 5 rows but as I have to use same sheet ,I am seeing last 4 rows are becoming duplicate. I do not want that duplicate rows.

If you want to overwrite the initial range, you need to delete it first from your original sheet, and only then you use write range…

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