Closed juve0811 closed 5 years ago
I have the same problem. Here is another reprex:
library(openxlsx)
testDf <- data.frame(a = 1:3, b = 3:1, c = letters[1:3], stringsAsFactors = FALSE)
wb <- createWorkbook()
addWorksheet(wb, "test")
writeData(wb, "test", testDf)
saveWorkbook(wb, "test.xlsx")
This generates 1 message and 1 error:
Note: zip::zip() is deprecated, please use zip::zipr() instead Error in zip_internal(zipfile, files, recurse, compression_level, append = FALSE, : Some files do not exist
I'm using opexlsx_4.1.1
Hi willemvdb42
Have you changed the windows environment variables recently? I was testing something else, and my script stop working, only the write.xlsx and saveWorkbook functions from "open.xlsx" package.
Yes, in fact I did change some of those recently. Which ones are you referring to specifically?
I don't remember now, trying to recover them since last week.
Seem like that is the root cause for our problem.
The error resolves itself if you add a TMP environment variable. As I suspected this is because the saveWorkbook
function uses the function tempdir
which creates a temporary directory and uses the TMP
variable (among a list of other options) to do this (see documentation for more info).
The relevant lines of code are on line 223 here. Note that tempdir is not called directly, but through the function tempfile
which uses tempdir()
as default value for its tmpdir
argument.
Hi
I added a TMP environment variable (C:\Windows\Temp) in the list, and the return value from tempdir as well, still showing "Some files do not exist".
Did you restart your R session before you tried? You can check your environment variables like this: Sys.getenv("TMP")
.
Did you restart your R session before you tried? You can check your environment variables like this:
Sys.getenv("TMP")
.
fixed with help from IT, reset the work directory from cmd. Thank you for your help.
0
Received this error message from R when using openxlsx package, not sure where to look.
Error in zip_internal(zipfile, files, recurse, compression_level, append = FALSE, : Some files do not exist
Does anyone have any suggestions? thanks.
The code is simple:
library(openxlsx) df1 <- cars write.xlsx(df1, file = 'cars.xlsx')