openxlsx icon indicating copy to clipboard operation
openxlsx copied to clipboard

Copying workbooks and performing changes on the copy destroys/applies the changes also to the original

Open deschen1 opened this issue 3 years ago • 0 comments

df <- data.frame(x = 1:3)
master_wb <- buildWorkbook(df)

readWorkbook(master_wb, sheet = 1)

  x
1 1
2 2
3 3

copy <- copyWorkbook(master_wb)

deleteData(copy, sheet = 1, cols = 1, rows = 2)
readWorkbook(copy, sheet = 1)

  x
1 2
2 3

readWorkbook(master_wb, sheet = 1)

  x
1 2
2 3

IMO, I would never expect a change made to a certain object/entity being applied to another object/entity.

deschen1 avatar Jan 20 '22 11:01 deschen1