我是靠谱客的博主 甜蜜花瓣,这篇文章主要介绍java合并excel文件,在Java中的一个工作簿中将两个Excel文件合并为两个表,现在分享给大家,希望可以做个参考。

I have two xlsx files at folder C:DemoFilesExceldemo1.xlsx and C:DemoFilesExceldemo2.xlsx.

I want to create a new xlsx C:DemoFilesExcelmerged.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");

最后

以上就是甜蜜花瓣最近收集整理的关于java合并excel文件,在Java中的一个工作簿中将两个Excel文件合并为两个表的全部内容,更多相关java合并excel文件,在Java中内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(100)

评论列表共有 0 条评论

立即
投稿
返回
顶部