Tuesday, January 7, 2014

Fastest Approach to Generate Excel File

The given jar fastexcel-0.5.1-2010-12-26.jar can write thousands of records into an excel file with in few seconds.

Here is the sample code:
public Static String fastExcelSample() {
File fileObj=new File("testFile.xls");
String contentData[]={"FAST","EXCEL","EXAMPLE","TEST"};
Workbook wb=FastExcel.createWriteableWorkbook(fileObj);
Sheet sheet=wb.addStreamSheet("SheetA");
addRow() method adds the Row into the sheet.  For multiple rows we can iterate and add multiple rows.
contentData[ ]  can be an object, which holds all the cell values of row and then write it into Excel file.
I have used it, it could able to write 20,000 records(each record 40 columns) in less than 20sec time.
Please find the attached jar file.


No comments:

Post a Comment