How to remove last row from Datatable

Hi All,

Can some help me to solve this’
I want to delete last row from datatable not from excel

Thanks in Advance!!!

3 Likes

Hello @Hitesh1,

Did you try Remove Data Row Activity and mentioning the Row Index??

2 Likes

I’ll assume your datatable is a variable called dt1.

Use the remove data row activity with the following as inputs in the properties window:
DataTable: dt1
Row: (leave this blank)
RowIndex: dt1.rows.count - 1

This will remove the last row of dt1. The reason why you include the minus 1 after rows.count is because the index of the datatable starts at 0, but counting the rows will start at 1 (e.g. row #1 will be index 0, but the count would start at 1)

10 Likes

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