I have two xlsx files at folder C:\DemoFilesExcel\demo1.xlsx and C:\DemoFilesExcel\demo2.xlsx.
I want to create a new xlsx C:\DemoFilesExcel\merged.xlsx that will have these two files as two sheets in merged.xlsx workbook.
This is to be done using apache POI in java. Any idea how to do
解决方案
//Open the first excel file.
Workbook SourceBook1 = new Workbook("F:\\Downloads\\charts.xlsx");
//Define the second source book.
//Open the second excel file.
Workbook SourceBook2 = new Workbook("F:\\Downloads\\picture.xlsx");
//Combining the two workbooks
SourceBook1.combine(SourceBook2);
//Save the target book file.
SourceBook1.save("F:\\Downloads\\combined.xlsx");