Error while importing xlsx file from url using the xlsx package in R

Hello,

I am using the following code to download an xlsx file from a website:

fileUrl <- "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.xlsx?accessType=DOWNLOAD"
download.file(fileUrl1,destfile = "./getting_cleaning/cameras.xlsx")

After this when I am trying to read the file using

camera_data <- read.xlsx("./getting_cleaning/cameras.xlsx",sheetIndex = 1,header = TRUE)

I am getting the error:

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  : 
  java.util.zip.ZipException: invalid entry size (expected 500 but got 504 bytes)

Can someone please help me with this!!

why not download the file and read it using this

1 Like

Thanks a lot @ajay_ohri.
It helped!! :smile:

@shuvayan, the variable names seem to differ fileUrl vs. fileUrl1. Or was that a typo just in this post?

@ajay_ohri, perhaps readxl is so recent that they haven’t yet included it in the standard MOOC curriculum. :wink:

Hello @anon,

Ya it was a typo :stuck_out_tongue:
You are also right about the RECENTNESS of the readxl package :smile: