Top 50 Records from a DataTable

how to get Top 50 records in a table
how to use this in UiPath dt.Rows.Cast<System.Data.DataRow>().Take(50)

i have a excel with 150 records and i loaded to a datatable, i need to get just process only 50 records per day, so i was planning to load to a datatable and process 50 record and remove the records from excel,

1 Like

Dt2 = Dt1.Clone

Dt2=Dt1.AsEnumerable().Take(50).CopyToDataTable()

10 Likes

Neat solution

Spammy :wink:

@vvaidya clone call is not necessary there, copytodatatable produces a new dt anyway.

Agreed.

Perfect, Thank you and elegent solution

hello all, how about bottom 3 row? Is there any shortcut, instead of manual sort dt then use the script above?