Do you mean that you try to write several dataframes to the same sheet? You have asked this before, and I think it has been said that that is not possible with write.xls. I suppose that you still try to write rows of data of varying length to one sheet. I think that is possible with the lowlevel functions of xlsx (like createRow, createWorkbook), but not with write.xlsx. Read the documentation of xlsx for this. I have no experience with this.
In addition to that: would you please stop sending messages in html? This has been asked to you before, and in general people are very irritated about this, and won't answer your questions. Frans 2016-01-15 15:43 GMT+01:00 Mohsen Jafarikia <jafari...@gmail.com>: > Hello all: > > I am having problem writing a few files in a single sheet of excel. It > seems R has problem writing on the same sheet. Maybe there is a command > that I am missing. Here is the code I am using: > > library(xlsx) > > ifn11 <- "A1.xlsx" > dat11 <- read.xlsx(ifn11, sheetName="A.csv", header = TRUE) > > ifn12 <- "A2.xlsx" > dat12 <- read.xlsx(ifn12, sheetName="A.csv", header = TRUE) > > ifn13 <- "A3.xlsx" > dat13 <- read.xlsx(ifn13, sheetName="A.csv", header = TRUE) > > ifn21 <- "F1.xlsx" > dat21 <- read.xlsx(ifn21, sheetName="F.csv",header = TRUE) > > ifn22 <- "F2.xlsx" > dat22 <- read.xlsx(ifn22, sheetName="F.csv",header = TRUE) > > ifn23 <- "F3.xlsx" > dat23 <- read.xlsx(ifn23, sheetName="F.csv",header = TRUE) > > write.xlsx(dat11, file="AC.xlsx", sheetName="A", append=FALSE) > write.xlsx(dat12, file="AC.xlsx", append= > TRUE) > write.xlsx(dat13, file="AC.xlsx", append= > TRUE) > write.xlsx(dat21, file="AC.xlsx", sheetName="F", append= TRUE) > write.xlsx(dat22, file="AC.xlsx", append= > TRUE) > write.xlsx(dat23, file="AC.xlsx", append= > TRUE) > > And here is the error message I am having: > > Error in .jcall(wb, "Lorg/apache/poi/ss/usermodel/Sheet;", "createSheet", > : > java.lang.IllegalArgumentException: The workbook already contains a sheet > of this name > > This error message comes after running the write.xlsx(dat13, > file="AC.xlsx", showNA=FALSE, row.names=FALSE, append= TRUE) line. Program > creates a sheet named "A" when writes dat11, then creates "sheet1" after > writing dat12 and when tries to write dat13, it gives me error. It seems it > tries to write on "sheet1" which already exists. I would like dat11, dat12 > and dat13 will be all written after each other on sheet "A" and dat12, > dat22 and dat23 in sheet "F". > > Anybody has any comments please. > > Regards, > Mohsen > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.