I followed these instructions I then followed these instructions:
# Write the first data set in a new workbook
write.xlsx(USArrests, file="myworkbook.xlsx",
sheetName="USA-ARRESTS", append=FALSE)
# Add a second data set in a new worksheet
write.xlsx(mtcars, file="myworkbook.xlsx", sheetName="MTCARS",
append=TRUE)
# Add a third data set
write.xlsx(Titanic, file="myworkbook.xlsx", sheetName="TITANIC",
append=TRUE)
Here is what I did on my end:
openxlsx::write.xlsx(Cost_Changes_0021_Table,'C:/Users/santi/Documents/Cost Changes xlsx/0021_Cost_Changes.xlsx', sheetName ='Dept 0021 Prod Level', row.names= FALSE, append = FALSE)
openxlsx::write.xlsx(Cost_Changes_0021_Vendor_Lvl_Table,'C:/Users/santi/Documents/Cost Changes xlsx/0021_Cost_Changes.xlsx', sheetName ='Dept 0021 Vendor Level', append= TRUE, row.names= FALSE)
I am not understanding why I am not getting multiple sheets after I run that script. What happens in the second line in my code overwrites the first sheet and then I only see one tab when really I want two tabs in the work book C:/Users/santi/Documents/Cost Changes xlsx/0021_Cost_Changes.xlsx