File opened with XLConnect doesn't close

428 Views Asked by At

I am working on an excel file with several sheets:

path_metadata<- file.path("archivos", "metadatos", "metadatos-copia.xlsx")
metadata_wb <- loadWorkbook(path_metadata)

Then I do some sheet manipulation (e.g. I write a data frame on a sheet), so I write it:

writeWorksheet(metadata_wb, df, sheet = "metadata")

And apply some style I have previously worked out

setCellStyle(metadata_wb,
             formula = rango_header_1,
             cellstyle = style_header)

And lastly, I save it

saveWorkbook(metadata_wb)

The problem comes when I try then to move onto the excel file and modify and save anything on it, it reports I cannot do it, because another instance keeps the file open. I cannot do a close(metadata_wb) with an object of class workbook What am I missing?

Thanx

0

There are 0 best solutions below