问题
I'm trying to read in an excel file from a URL: https://www.misoenergy.org/Library/Repository/Market%20Reports/20140507_sr_la.xls
I can download the file, and read it in using read.xls from the gdata package no problem.
But I get an error when trying to read it in directly.
Unable to open file 'https://www.misoenergy.org/Library/Repository/Market%20Reports/20140507_sr_la.xls'.
Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method, :
Intermediate file '/tmp/RtmptxiYS1/file42f8532a0129.csv' missing
I've tried this: Importing Excel file using url using read.xls but the 's' in 'https' is required.
回答1:
Try this
library(gdata)
tmp <- tempfile()
download.file("https://www.misoenergy.org/Library/Repository/Market%20Reports/20140507_sr_la.xls",
destfile=tmp, method="curl")
read.xls(tmp, skip=2)
unlink(tmp)
来源:https://stackoverflow.com/questions/23531897/read-xls-gdata-from-an-https-url