Reputation: 3158
I'm trying to download a large number of xls files from the BLS servers. When I manually download any of the files, they open perfectly.
But when I try to download the file from inside R:
library(readxl)
tp <- "http://www.bea.gov/histdata/Releases/GDP_and_PI/2014/Q4/Third_March-27-2015/Section1ALL_Hist.xls"
temp <- paste0(tempfile(), ".xls")
download.file(tp, destfile = temp, mode = "wb")
this downloads a file of the right size, but attempting to read the file:
data <- read_excel(path = temp, sheet = 1)
returns the error
seek: wanted to seek to sector 5374034 (0x520052) loc=2751505920
Upvotes: 3
Views: 464
Reputation: 57686
Set mode="wb"
to do a binary transfer:
download.file(tp, destfile=temp, mode="wb")
Upvotes: 3