GeeCON Prague 2014*
The moose likes Other Open Source Projects and the fly likes How tochange the values in an existing Excel file by using POI? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How tochange the values in an existing Excel file by using POI?" Watch "How tochange the values in an existing Excel file by using POI?" New topic
Author

How tochange the values in an existing Excel file by using POI?

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I'm pretty new to use POI. I can read values from Excel file by reading it. But during the read, it seems I cannot change Excel cell values.



The above code won't really change the value to "TEST" for that cell after the program is finished.

If using FileOutStream with an output file name, I think it's just gonna overwrite the existing file, or create a new file.

How can I change the values in an existing file? Thanks.


SCJA, SCJP5.0, SCBCD, SCWCD
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
How are you saving the file after changing the value?


Ping & DNS - my free Android networking tools app
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
How to save it?

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
How to save it?

Does that mean you don't have any code to save the file? If so, that's what the HSSFWorkbook.write(OutputStream) method does.
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I worked it out. I thought HSSFWorkbook.write(fileOut); where there is nothing involved with fileOut would produce an empty Excel file. But it's not.

Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How tochange the values in an existing Excel file by using POI?