This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you saving the file after changing the value?
 
reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to save it?

Thanks.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic