How to remove rows whose index are more than 5

Hi All,

I hope everyone doing good.

I Need to remove rows whose index are more than 5, someone please help me how to do so??

Thanks in advance.

Hi @HeartCatcher

Clarification needed!

As you need to take the only 5 rows from the datatable?


yes correct

Hi @HeartCatcher

This link would help you

refer points 14 and 15

Hi @HeartCatcher

Use the expression below!


This will fetch only five rows from the datatable


1 Like

hi @HeartCatcher
if you need only 5 rows you can use something like this in assign activity

Dt2 = Dt1.Clone


1 Like


can you close the topic if your topic is resolved

Happy automation

Hi @HeartCatcher,

Use an excel application scope inside it use Read Range to read the datatable say the datatable id DTBook.

use Assign activity in LHS use variable say DTModified with type as Datatable in RHS write something like DtBook.AsEnumerable().Take(5).CopyToDataTable()

which gives you DTModified = DtBook.AsEnumerable().Take(5).CopyToDataTable()
this will give you 5 rows from the starting of datatable