We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Combine multiple sheets into a single one using Aspose.Cells for Java


I am creating multiple sheets in a workbook (Each sheet contains data as well as charts) using aspose cells . Is it possible to combine all the sheets in that workbook into a single sheet? Please help.



Yes, it is possible. Please see the code below, it combines the first xls file with another xls file.

Please see the source and output workbooks.


String pathFirst = “f:\downloads\first.xls” ;

String pathSecond = “f:\downloads\second.xls” ;

Workbook firstWorkbook = new Workbook();


Workbook secondWorkbook = new Workbook();




Thanks. This sample code combines two xls workbook and saves it as a new workbook.

Out requirement is in one xls workbook we have multiple sheets with charts and data. We need to combine these multiple sheets in the same workbook into a single sheet. Will that be possible?


I think, then you should try copying rows from second source sheet into the end of first source sheet.

You can see copying rows example from this post: 298463


Also, check some more documents for your further reference:

Thank you.

Thanks for the references… Will get back again if I need any clarifications.


Now am able to copy the data from one sheet to another using copyCellsRamge() method. I need to now copy the shapes from the source sheet to destination sheet. Is it posible to get the position and size of the shape from the source excel sheet and get the relative postion (where the shape needs to be copied ) in the destination excel sheet and copy the shape ?



Hi Geetha,

Please see the below linked article on the subject [copying shapes between worksheets]. Also, feel free to write back. Thank you.

Note: You have marked you first post related to JAVA API but some of the replies are pointing to .NET. So I’m supplying you both links.


Hi can u please provide code for merging multiple excel file (.xlsx) around 30 files into one excel file using java… Aspose.cell

Hi Sachin Dagar,

Well, I think you may try to use Workbook.combine() method to merge workbooks (you have to loop through your files to be opened and then merge the workbooks one by one into your master workbook accordingly) , see the document on combining multiple files into one file for your reference:

Thank you.