aspose file tools*
The moose likes Java in General and the fly likes java Excel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java Excel" Watch "java Excel" New topic
Author

java Excel

anvi kon
Ranch Hand

Joined: Jan 08, 2010
Posts: 133
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
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Apache POI is the best option.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10520
    
    9

http://www.andykhan.com/jexcelapi/tutorial.html


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14339
    
  22

Have a look at the page Accessing File Formats in our FAQ pages.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42600
    
  65
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.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

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

Joined: Jan 08, 2010
Posts: 133
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
Marshal

Joined: Mar 22, 2005
Posts: 42600
    
  65
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

Joined: Jan 08, 2010
Posts: 133
Yes, It doesn't have a example which saves the excel file into another file.


Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18887
    
    8

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java Excel