writing to excel in java

JJunior picture JJunior · Aug 11, 2010 · Viewed 60.7k times · Source

Can someone point me in the right direction for writing to an excel file in java?? I am not understanding the links I found online. Could you just send me a link or anything which I could follow through??

Thank you, J

Answer

matt b picture matt b · Aug 11, 2010

Another alternative to Apache POI is the JExcelAPI, which (IMO) has an easier to use API. Some examples:

WritableWorkbook workbook = Workbook.createWorkbook(new File("output.xls"));

WritableSheet sheet = workbook.createSheet("First Sheet", 0);

Label label = new Label(0, 2, "A label record"); 
sheet.addCell(label); 

Number number = new Number(3, 4, 3.1459); 
sheet.addCell(number);