Hi,

append=TRUE is supposed to work for appending new sheets to an existing spreadsheet. That is the most common use. I'll improve the documentation of write.xlsx.

If you want to append to an existing sheet, you have two choices:
1) remove the sheet first, and than write it again with the new data
2) use low level functions, that is: setCellValue, etc.

Best,
Adrian


On Mon, 6 Sep 2010, Ravi S. Shankar wrote:

Hi Adrian,



dat=data.frame(matrix(0,3,3))



write.xlsx(dat,"z:/dat.xlsx",sheetName="sheet1",append=F)

write.xlsx(dat,"z:/dat.xlsx",sheetName="sheet2",append=F)



The above code works and creates new worksheets. But if I want to append
to an existing worksheet I seem to get an error.



write.xlsx(dat,"z:/dat.xlsx",sheetName="sheet2",append=T) - This gives
an error saying "The workbook already contains a sheet of this name"



Could you please let me know how to append data to  an existing sheet
and not create a new sheet each time?



Thank you

Ravi


e-mail in error) please notify the sender immediately and destroy this e-mail. 
Any unauthorized copying, disclosure or distribution of
the material in this e-mail is strictly forbidden.  Any views or opinions 
presented are solely those of the author and do not
necessarily represent those of Amba Holdings Inc., and/or its affiliates.  
Important additional terms relating to this email can be obtained
at  http://www.ambaresearch.com/disclaimer


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to