I have to delete a sheet from the Excel file.
Here\'s my code snippet :
FileInputStream fileStream = new FileInputStream(destFile); POIFSFileSystem fsPo
private void removeOtherSheets(String sheetName, XSSFWorkbook book) { for(int i=book.getNumberOfSheets()-1;i>=0;i--){ XSSFSheet tmpSheet =book.getSheetAt(i); if(!tmpSheet.getSheetName().equals(sheetName)){ book.removeSheetAt(i); } } }