How to Copy one excel file data to another excel file with different sheet name

i have one excel file(expense1) in which 30 data is there.Now i want to copy data from “expense1” file into another excel file(expense2) in such a way that each sheet of “expense2” file contains 10 per sheet. like sheet1 will contains 10 data, sheet2 will contains 10 data, sheet3 will contains 10 data of expense2 file from expense1 file. How to achieve this using loop?

@Rahul_Raj, Implement this while logic after reading your excel expense 1.

Excel

For your reference : In write range I have written dt.AsEnumerable().Skip(nSkip).Take(nTake).CopyToDatatable()

nTake is the number of rows based on which you split into different sheet here its 10.

Regards,
Dominic :slight_smile:

Hi, this logic works fine sometimes but creates excel with wrong number of rows sometimes. For example if I have excel with 22rows and want to create sheet with 10rows(1st and 2nd sheet with 10rows and 3rd sheet with 2rows) it’s creating all sheets with 10rows and sometimes sheet is empty. Can anyone help me on this plz.
Thank you