我尝试XLconnect
和Xlsx
,但徒劳无功。
代码如下。
require(XLConnect)
require(xlsx)
a<-read.xlsx("C:\\R\\CPC2.xlsx",1,as.data.frame=TRUE)
b<-read.xlsx("C:\\R\\CPCVoucher1.xlsx",1,as.data.frame=TRUE)
wk <- loadWorkbook("XLConnectExample1.xlsx", create = TRUE)
writeWorksheet(wk, a, sheet = "test", startRow = 1, startCol = 2)
writeWorksheet(wk,b, sheet = "test", startRow = 15, startCol = 2)
saveWorkbook(wk)