I have a excel file data.xlsx
, which has two sheets Sheet1
and Sheet2
, now I want to append df1
and df2
from R
into data.xlsx
with names Sheet3
and Sheet4
, I have tried with:
library(xlsx)
write.xlsx(df1, "data.xlsx", sheetName = "Sheet3", row.names = FALSE)
write.xlsx(df2, "data.xlsx", sheetName = "Sheet4", row.names = FALSE)
But it overwrites the orginal file's Sheet1
and Sheet2
, how could we solve this problem?
Thanks.