File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

writing into excel sheet

 
ranjan manohar
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

My requirement is I have to write the Data into a Microsoft excel sheet. That I was able to do. But now my problem is, I have new requirement of writing into same excel sheet for whole month. I mean my program has to create a new excel sheet every month starting and should write all data into same excel till that month end. Even my program runs repetitively for every 30min in a day. I have attached my program here below which will write into excel sheet. Can anyone suggest me the modification which satisfies my requirement.

Thanks in advance,
Ranjan



 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently the code uses only a single sheet. You'll have to add new ones for each month: http://poi.apache.org/spreadsheet/quick-guide.html#NewSheet You may want to give the sheets meaningful names, maybe the month names, or a number from 1 to 12.
 
ranjan manohar
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That part is okay… but how can I write into same sheet again and again, because my program will run for every 30 min. How can write all the values into the same sheet in a span of one month. Please suggest some solution. Should I have to do some modification in constructor?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I fully understand the question, but you can get references to existing sheets using the HSSFWorkbook.getSheet(String) and HSSFWorkbook.getSheetAt(int) methods.
 
ranjan manohar
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot...
 
Bijj shar
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually procedure should be save all data in data base and generate monthly report in xls sheet format. I don’t understand why all data writing requirement in same xls sheet in every 30 minute. I could think simple scenario if machine crashes or xls modified or deleted where will find the backup data means all data will be lost.

Don’t mind if you are not agree…
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic