xls - Create New Sheet

Code to create new sheet in the xls workbook:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
public boolean addSheet(String sheetname){

 FileOutputStream fileOut;
 try {
  workbook.createSheet(sheetname);
  fileOut = new FileOutputStream(path);
  workbook.write(fileOut);
  fileOut.close();
 } catch (Exception e) {
  e.printStackTrace();
  return false;
 }
 return true;
}