Splitting one excel file to multiple excel files

Hello every one

Here i have one excel file with 100 records , i want to split this file to 10 excel files with 10 records each is there any way to execute with out using Linq query

@adarsh_kotagiri,

Can you try with below query?

var Rows = yourDt.AsEnumerable().Take(10).CopyToDatatable

or you can follow below approach

read sheet
create boolean variable here boolNotTen = True
while boolNotTen {
if dt.rows.count > 10 {
take only 10 rows by reading same sheet A1:B10
delete range A1:B10
you will have 90 rows in sheet
create new excel and provide 10 rows dt
}else{
read remaining rows
set boolean variable to false
boolNotTen = False // will be out of loop
}
}

Cheers,
Pankaj

Cheers,
Pankaj

Thank you sir​:+1::+1::+1:

1 Like

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