read.xls (gdata) - from an https url

↘锁芯ラ 提交于 2020-01-06 15:44:30

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!