Split excel files if they exceed 500 rows

hello,

i have a folder which contains multiple excel files. I iterate through all items in this folder and merge them into one excel file. The second part of the requirement is, to split this merged excel file, if it exceeds 500 rows. I’m struggling with the second part of the requirement. How can I achieve this ? Thanks in advance

Please Linq query for the second part.

yourDT.AsEnumerable.Skip(x).Take(500);

Read your excel data into datatable and use skip and take.

x = 0, for first 500 rows
x=500, for 500-1000 rows

1 Like

@RoboBob
find starter help here:
DTSlice_BySegmentSize_ToTableList.xaml (10.5 KB)

Explanation of the concept you can find here:

1 Like

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