awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
364 stars 79 forks source link

cloneWorksheet() should work across workbooks #502

Open Moohan opened 4 years ago

Moohan commented 4 years ago

Currently cloneWorksheets only works for copying sheets within a single workbook. I would like to be able to take a sheet from one workbook and copy it into another. My use case for this is having a stock notes or other sheets which I can read and then insert into my openxlsx created workbooks

notes_wb <- loadWorkbook("notes.xlsx")
final_workbook <- createWorkbook()
writeData(final_workbook , "Data", data)
cloneWorksheet(final_workbook, "Notes", notes_wb $worksheets[[1]])
saveWorkbook(final_workbook, file = "final.xlsx")
ycphs commented 4 years ago

Please check the current package repository ycphs/openxlsx.

cryptobiotic commented 3 years ago

@ycphs I installed the latest, the behavior of cloneWorksheet seems to be unchanged. Any idea how to effectively copy a worksheet object from one workbook to another? Thanks!