Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Sat Nov 08, 2014 11:00 am

Hi,
I am testing the Spire.XLS library and wanting to combine multiple XLS files into a new file.

I have tried the following code:
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"C:\TestFiles\test.xls", ExcelVersion.Version97to2003);
Workbook workbook2 = new Workbook();
workbook.LoadFromFile(@"C:\TestFiles\add.xls", ExcelVersion.Version97to2003);
workbook.Worksheets.AddCopy(workbook2.Worksheets);

workbook.SaveToFile(@"C:\TestFiles\Combined.xls", ExcelVersion.Version97to2003);

All I end up is the original file and 3 blank worksheets.
Can you give me some pointers as to the best method of combining the files?

Cheers,
Mark.

mfiksen
 
Posts: 2
Joined: Thu Nov 06, 2014 10:43 am

Sat Nov 08, 2014 12:49 pm

OK figured out why the sheet wasn't being brought in.

mfiksen
 
Posts: 2
Joined: Thu Nov 06, 2014 10:43 am

Wed Feb 25, 2015 6:45 am

Hello mfiksen,

Please feel free to contact us if you have any questions.
Best Regards,
Burning
E-iceblue Support Team
User avatar

burning.liu
 
Posts: 406
Joined: Mon Aug 04, 2014 6:47 am

Return to Spire.XLS