Delete an excel sheet using Apache POI

前端 未结 3 1460
轮回少年
轮回少年 2021-02-07 12:43

I have to delete a sheet from the Excel file.

Here\'s my code snippet :

FileInputStream fileStream = new FileInputStream(destFile);
POIFSFileSystem fsPo         


        
3条回答
  •  青春惊慌失措
    2021-02-07 13:07

    After editing your workbook, you need to write it again. Try this:-

    FileOutputStream output = new FileOutputStream(destFile);
    workbook.write(output);
    output.close();
    

    Edit:- After writing it back, you can return your destFile.

提交回复
热议问题