ycphs / openxlsx

openxlsx - a fast way to read and write complex xslx files
https://ycphs.github.io/openxlsx/
Other
224 stars 75 forks source link

saveWorkBook() not overwriting #350

Closed omertayyab closed 2 years ago

omertayyab commented 2 years ago

saveWorkBook() function does not overwrite the file when loaded workbook is in same directory. It doesn't matter if the names are differentiated. It instead creates a new file with the extension .xlsxTRUE or .xlsxFALSE depending on how you supply the overwrite argument I'm using version 4.2.5 of the package Using in R studio, R version 4.1.2

Example: wb <- loadWorkbook(paste0(dir_local,"LFS_data.xlsx")) writeData(wb, sheet = "SA2", basedef, colNames = FALSE, startRow = 1, startCol = length(result)) writeData(wb, sheet = "SA2", result, colNames = TRUE, startRow = 2) saveWorkbook(wb,paste0(dir_local,"LFS_data2.xlsx",overwrite = TRUE))

JanMarvin commented 2 years ago

Hi @omertayyab , you have a typo in your last line. overwrite is part of openxlsx not of paste.