File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Writing a content in excel in incremental way Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Writing a content in excel in incremental way" Watch "Writing a content in excel in incremental way" New topic

Writing a content in excel in incremental way

Vibhas Kumar

Joined: Oct 13, 2009
Posts: 28
Hi friends i am facing one issue while writing the content in an excel sheet incrementally.When i try to add the next content in an existing excel sheet. I loose the previous one.Can any one help me to resolve this.Here is the code for this. I have created two java classes 1.ReadXLSheet -->to read the file 2.Create--> to write the content incrementally.

Kindly look into it and resolve this issue.


Thanks in advance
Rob Spoor

Joined: Oct 27, 2005
Posts: 20269

Please mind your language. I've removed the offensive word from the subject.

How To Ask Questions How To Answer Questions
Greg Charles

Joined: Oct 01, 2001
Posts: 2967

Hi Kumar,

You'll probably get better responses if you post less, more targeted code samples, and more information about what you're doing and what's going wrong.

In this case, I haven't worked with the jxl.Workbook class, but I see you create a new one each time you call the write() method, and pass it (I assume) the same file as a parameter. When you later call workbook.write(), I'm guessing it overwrites whatever was in the file with the new contents of the workbook. If that's not what you want to happen, you're going to have to go back to Workbook and see if it has another interface you can use.

Also, take a look at this code:

That's just confusing.
Lester Burnham

Joined: Oct 14, 2008
Posts: 1337
The javadocs of Workbook.createWorkbook(File,WorkbookSettings) talk of "creating" a file - which doesn't sound as if it would preserve an existing one. One of the other createWorkbook methods may be more suitable.
I agree. Here's the link:
subject: Writing a content in excel in incremental way
It's not a secret anymore!