Hi,

I like to write/or export different summary tables in R into different

sheets of a single excel. Now I am reading the data using openxlsx,

see my following example code, I want to write *Cst_1* and *Cst_2 *in different sheets by their names in *one single excel* called XX.xlsx

library(openxlsx)

Cst_1= read.xlsx(".../R50.xlsx", sheet ="Cst_1", startRow = 1, colNames = TRUE)

Pivot_Group= aggregate(cTrans_hjw ~ Assort, Cst_1, sum)

write.xlsx(Pivot_Group,file = "...\\XX.xlsx", sheetName ="Cst_1")#

Cst_2= read.xlsx(".../R50.xlsx", sheet ="Cst_2", startRow = 1, colNames =

TRUE)

Pivot_Group2= aggregate(cTrans_hjwT ~ Assort, Cst_2, sum)

write.xlsx(Pivot_Group2,file = "....\\XX.xlsx", sheetName ="Cst_2",append =TRUE)

I also try xlsx package by adding library (XLSX), but i have got an error or conflict due to being old of this library rather than openxlsx

I would be appreciated for any thought

Similar questions and discussions