wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Export excel using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Export excel using java" Watch "Export excel using java" New topic
Author

Export excel using java

vardhan reddy
Ranch Hand

Joined: Oct 28, 2011
Posts: 42
Hi All,

I have to export details from data base to excel using java, which API is best to export data and my data size is 500k.
Apache POI is one option, I think we wont get performance because of data size.

Thanks,
vardhan
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Do you mean "we won't get good performance"? That depends on what your definition of "good performance" is. 500KB is not a huge amount of data; POI should not have problems creating such a file.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

With Excel files of this size you will almost certainly get a performance hit.
Furthermore, the number of records exceeds 65,536 which means you cannot use the XLS format (Excel 97 / 2000 / 2003). It has a maximum of 65,536 rows per sheet. You will need to use the XLSX format (Excel 2007 / 2010) which has a limit of 1,048,576. I know only one library for that, Apache POI, with its XSSFxxx classes.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
vardhan reddy
Ranch Hand

Joined: Oct 28, 2011
Posts: 42
Tim,
I thought we won't get performance.
Rob,
Thanks for your point i will check row count.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
vardhan reddy wrote:I thought we won't get performance.

Without a definition of what "performance" means to you this statement is meaningless. Can you quantify it?

Also, what did you mean by "data size is 500k"? I thought 500KB of data; Rob thought 500.000 rows of data. Is it either of these, or something else entirely, like 500.000 cells filled with data?
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7492
    
  18

vardhan reddy wrote:Apache POI is one option, I think we wont get performance because of data size.

You haven't even got a solution yet, and you're already worried about what the performance might be? I refer you to my quotation below.

Get a working solution first, and THEN worry about performance; and unless you plan on writing your own Excel file writer, you'll be stuck with whatever performance you get from a 3rd party product, so I wouldn't sweat it too much. And like the others, I'd say Apache POI is probably the place to start.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
vardhan reddy
Ranch Hand

Joined: Oct 28, 2011
Posts: 42
Also, what did you mean by "data size is 500k"? I thought 500KB of data; Rob thought 500.000 rows of data. Is it either of these, or something else entirely, like 500.000 cells filled with data?

500.000 rows of data. Rob told good point which i don't know.

Winston,
I have started working with POI. I will get back to you guys if I need any help.
Shahzad Latif
Greenhorn

Joined: Apr 28, 2011
Posts: 28
You might also want to have a look at Aspose.Cells for Java, which allows you to import data from a database to a worksheet. The process is as simple as the following three steps:

1. Query your data from the database
2. Put the data in ResultSet
3. Import the data from ResultSet to the worksheet

Please see if this might help in your scenario. Please also note that this component provides comprehensive documentation and support as well; it also provides a lot of other features to work with Excel files.


Developer Evangelist @ Aspose. I love to explore and learn new technologies and help other developers along the way.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Export excel using java
 
Similar Threads
how to export data to Excel
Java MySQL MS Excel
Number Stored as Text in Excel Output
Generating Graphs using POI
CSV file opening in Excel - cell auto adjustment using JasperReports