Merging Two excel files as two sheets in one workbook in java

前端 未结 4 1426
花落未央
花落未央 2021-01-02 10:16

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

4条回答
  •  旧巷少年郎
    2021-01-02 11:05

    //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");
    

    http://www.aspose.com/docs/display/cellsjava/Combine+Multiple+Workbooks+into+a+Single+Workbook

提交回复
热议问题