• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

java Excel

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need some examples for reading an excel file and save it automaticallyin java?

I'm using jxl , but Idon't see any method save in jxl API.

Thanks
 
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apache POI is the best option.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.andykhan.com/jexcelapi/tutorial.html
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the page Accessing File Formats in our FAQ pages.
 
Sheriff
Posts: 22665
127
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Meet Gaurav wrote:Apache POI is the best option.


I disagree; I prefer JExcelAPI (JXL) myself.

Anvi, check out Workbook.createWorkbook. These methods allow you to specify the file or output stream to write the workbook to. WritableWorkbook has methods write() and close() you can use for the actual writing and cleaning up.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Apache POI is the best option.

I disagree; I prefer JExcelAPI (JXL) myself.


Without any qualifications, neither of these statements is very convincing. Why do you think one is better than the other?

POI does have the advantage of handling XLSX in addition to XLS, and of having APIs very similar to HSSF/XSSF for other document formats (thus providing a head start if one knows HSSF/XSSF already). Of course, it's possible that neither of these matter in this particular case.
 
Rob Spoor
Sheriff
Posts: 22665
127
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I last tried both, I found retrieving the cell formatting much easier in JExcelAPI. But that said, in most cases neither one is the best option; it is all a matter of opinion. And Anvi has already chosen for JExcelAPI, then who are we to say that he/she should switch to POI?
 
anvi kon
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How would I save the excel file using JEXCEL . I have used write but it writes only to the WritableSheet but it didn't save it?

Also does it supports charts and graphs?

Which source is best for graphs and charts?

thanks
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check out the link Maneesh posted? It has a section on "Writing Spreadsheets" which seems to be spot on.
 
anvi kon
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, It doesn't have a example which saves the excel file into another file.


 
Marshal
Posts: 27286
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

anvi kon wrote:Yes, It doesn't have a example which saves the excel file into another file.



That's true. It doesn't have an example which reads a spreadsheet from a file, modifies it, then saves it in another file. But as the tutorial itself observes, you can't write a tutorial which shows exact examples of everything somebody might want to do. It says:

The tutorial is by no means exhaustive, and if something is not described here, it does not mean that it cannot be done. The reader is encouraged to examine the API documentation and the sample code (particularly Write.java and ReadWrite.java) in order to gain a more complete understanding of the capabilities and limitations of the software.



So if it was me with this question, I would now be looking at the ReadWrite.java example to see what it did. And then I would be reading the API documentation of the Workbook class to look for possible solutions.
 
reply
    Bookmark Topic Watch Topic
  • New Topic