RoboBob
November 6, 2020, 12:52pm
1
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
…
2 Likes
ppr
(Peter Preuss)
November 6, 2020, 1:15pm
3
@RoboBob
find starter help here:
DTSlice_BySegmentSize_ToTableList.xaml (10.5 KB)
Explanation of the concept you can find here:
@christine.tzenghy
let me introduce a general approach that can be also adopted to more case specific details.
Assumptons:
DataTable with 8 Rows
Segmentsize: 3
Following Building Blocks are used
Calculation of the numbers of segments:
[grafik]
with the Ceiling method the fractions are uprounded to the next Integer
with the Skip() and Take() Method the Rows for a segment can be retrieved.
the different segments are bult by following
[grafik]
and do fetch the different segment rows by: …
1 Like
system
(system)
Closed
November 9, 2020, 1:15pm
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.