Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading Excel: evaluation error with zip file '..file.xlsx' cannot be opened

Tags:

I am using R with readxl package. I try to import an Excel file with the following command:

library(readxl) city_codes <- read_excel("./data/file.xlsx", sheet = "city_codes") 

It says it is a zip file and cannot be opened:

Error in sheets_fun(path) :  Evaluation error: zip file './data/file.xlsx' cannot be opened. 

Any ideas?

like image 988
canpoint Avatar asked Jun 18 '17 21:06

canpoint


People also ask

How do I unzip an XLSX file?

Xlsx files are just ZIP files, so you can simply unzip them right away using your favourite ZIP tool. Open your zip file tool, like for example, Winrar, find your excel file there, right-click on it, then you can simply "extract to a specified folder" and then your xml files will be saved there.


1 Answers

I had this error, but for me, it was just that I had the sheet open in Excel while trying to read it into R. I guess the package wrongly perceives it as a zip file when it's trying to read it while Excel has partial ownership of it (and this blocks the read).

like image 59
DHW Avatar answered Oct 11 '22 21:10

DHW