Split excel file from datatable

Hello guys,
I’ve save an excel data on a datatable.
Now I need to split rows like this : treat first 30 line and do some configuration and after, do the second 30 and so on thanks a lot.

You can use this to select the top 30 rows @ifranity

dt.AsEnumerable.Take(30).CopyToDataTable()

1 Like

Check out the answer here on how to do it within a loop to ensure all rows are processed: Copy first N rows from Datatable from specific column and get next set - #6 by Dave

1 Like

Hi @ifranity,
Assume that you have 50 records in the DataTable. It has to split by 30 and 20. Like below you can able to assign to a datatable.

dataTable.AsEnumerable.Take(30).CopyToDataTable()

dataTable.AsEnumerable.Skip(30).Take(20).CopyToDataTable()

Regards
Balamurugan.S

1 Like