openxlsx icon indicating copy to clipboard operation
openxlsx copied to clipboard

cloneWorksheet() should work across workbooks

Open Moohan opened this issue 4 years ago • 2 comments

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")

Moohan avatar Nov 21 '19 14:11 Moohan

Please check the current package repository ycphs/openxlsx.

ycphs avatar May 09 '20 09:05 ycphs

@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!

cryptobiotic avatar Dec 11 '20 19:12 cryptobiotic