Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Export excel using java

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 7611
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22791
131
Eclipse IDE Spring Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Saloon Keeper
Posts: 7611
177
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
He's my best friend. Not yours. Mine. You can have this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic