简体   繁体   中英

Import Excel data into R using openxlsx: Error in file(con, "r") : invalid 'description' argument

I am trying to import the data in my Excel file into R using Openxlsx library:

library(openxlsx)
data <- read.xlsx("datafile.xlsx", sheet = "Sheet1")

However, I get the following error:

Error in file(con, "r") : invalid 'description' argument
In addition: Warning message:
In unzip(xlsxFile, exdir = xmlDir) : error 1 in extracting from zip file

This error is thrown because your Excel file is open. Save and close the Excel file and try again, it will work.

Error is also returned when file is password-protected

I'm currently having this issue, but I have confirmed (multiple times) that the files of interest are closed. I have also restarted my computer. Any ideas about what could be causing this besides an open file?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM