Rename excel sheets

Hi all,
I have one spreadsheet with 4 sheets in it, and I want to rename the sheets when I export the file from R.
How can I do it?
This is what I have so far:
sheets <- list(sheet1 = Top_Balances, sheet2 = Over_60, sheet3 = CI, sheet4 = CL)
write_xlsx(sheets, "C:/Users/Desktop/R/April Aging.xlsx")

Thanks!

Hi! You can try the code below:

library(xlsx)

write.xlsx(Top_Balances, "April Aging.xlsx",sheetName = "Name1")
write.xlsx(Over_60, "April Aging.xlsx",sheetName = "Name2",append=T)
write.xlsx(CI, "April Aging.xlsx",sheetName = "Name3",append=T)
write.xlsx(CL, "April Aging.xlsx",sheetName = "Name4",append=T)

where you have sheet1, sheet2 etc - put in the name you want give to those sheets.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.