Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

java Excel  RSS feed

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Apache POI is the best option.
 
Java Cowboy
Sheriff
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the page Accessing File Formats in our FAQ pages.
 
Sheriff
Posts: 21502
96
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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: 42973
76
  • Mark post as helpful
  • send pies
  • 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: 21502
96
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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: 133
  • Mark post as helpful
  • send pies
  • 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: 42973
76
  • Mark post as helpful
  • send pies
  • 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: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, It doesn't have a example which saves the excel file into another file.


 
Sheriff
Posts: 23714
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!