'openxlsx deleteRows corrupting file

Im reading in a template file, delete rows and then saving the file again but when I try to open up the file excel says it is corrupted.

Here is my code:

template <- loadWorkbook('foo.xlsx')
deleteData(template,sheet=1,cols=1:10000, rows = 6:10005 gridExpand = FALSE)
saveworkbook(template,'foo-test.xlsx',overwrite = TRUE

I have even tried it without the deleteData line and it still corupt the file.

Anyone have ideas son how I can change my code/ not corrupt the file.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source