0

I am trying to webscrape a xls page of oil stocks.

I tried :

 library("readxl") 
 df <-read_excel("https://www.eia.gov/dnav/pet/hist_xls/W_EPC0_SAX_YCUOK_MBBLw.xls",sheet="Data 1")

but I get an error message: Error: path does not exist

Thank you for your help.

adam.888
  • 7,686
  • 17
  • 70
  • 105
  • take a look at this question https://stackoverflow.com/questions/21738463/importing-excel-file-using-url-using-read-xls – DS_UNI Jan 05 '19 at 19:26
  • 1
    I am not sure readxl supports accessing a file over the internet. One work around is to use `download.file` and then read the file from your local drive. – Dave2e Jan 05 '19 at 20:11
  • @Dave2e is correct. This method works for me: https://stackoverflow.com/questions/41368628/read-excel-file-from-a-url-using-the-readxl-package – Khaynes Jan 05 '19 at 20:50
  • Thanks, I tried this but I could not get the correct dates. I tried df1$Date <- as.Date(df1$Date, "%m/%d/%Y") but then got NA – adam.888 Jan 06 '19 at 11:33

0 Answers0