Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Export excel using java

 
vardhan reddy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2803
41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vardhan reddy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim,
I thought we won't get performance.
Rob,
Thanks for your point i will check row count.
 
Tim Moores
Bartender
Posts: 2803
41
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10417
63
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
vardhan reddy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic