开发者

Copy Excel Sheet using Apache POI

How to copy one entire Excel sheet into another Excel she开发者_C百科et of the same workbook, using Java SE and Apache POI?


You'll probably want the cloneSheet(sheetNumber) method on the Workbook. See the JavaDocs for details


Did you check the API?

to copy a sheet into the same workbook, use HSSFWorkbook.clonesheet(int sheetIndex)

Ivan's comment has linked the question for copying across workbooks.


Yes , this can be...Here my code.

            XSSFWorkbook workbook = new XSSFWorkbook(file);
            int totalRecords = 5;
            for (int i = 0; i < totalRecords - 1; i++) {
                workbook.cloneSheet(1);
            }
            for (int i = 1; i <= totalRecords; i++) {
                workbook.setSheetName(i, "S" + i);
            }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜