• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing to EXCEL -- Workbook.write() not working

 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to write some data to an excel using the below code. The data in MyExcel1 can be found in the variable "copy". But is not getting written to MyExcel2.xls
Please help !!



Regards,
Priya Sri
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't look like the code writes to MyExcel2.xls. It writes to whatever is returned in line 2. I'm not sure what that would be - java.util.File has no method called createTempFile(String).
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very sorry...the code there is actually like this:
excelFile = File.createTempFile("MyExcel1", ".xls",new File("C:\"));
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so that confirms it - nothing would get written to MyExcel2.xls.

Why are you using createTempFile instead of "new File"?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic