0

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.

Community
  • 1
  • 1
imgschatz
  • 95
  • 2
  • 9
  • Download it with your browser. Then read it from disk. – IRTFM May 08 '14 at 03:13
  • this needs to be a purely automated process. I can download the file using a system("wget file dest") but would prefer to not do this. – imgschatz May 08 '14 at 03:19
  • R has problems with `https://` in calls to `file()`. You need to explain further why your "preferences" are compelling – IRTFM May 08 '14 at 03:26

1 Answers1

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)
GSee
  • 48,880
  • 13
  • 125
  • 145