Aaron Ferguson Aaron Ferguson - 1 year ago 59
Java Question

How Do I Create a New Excel File Using JXL?

I'm trying to create a new Excel file using jxl, but am having a hard time finding examples in their API documentation and online.

Answer Source

After messing around awhile longer I finally found something that worked and saw there still wasn't a solution posted here yet, so here's what I found:

try {
    String fileName = "file.xls";
    WritableWorkbook workbook = Workbook.createWorkbook(new File(fileName));
    workbook.createSheet("Sheet1", 0);
    workbook.createSheet("Sheet2", 1);
    workbook.createSheet("Sheet3", 2);
} catch (WriteException e) {