0

I'm interested in importing directly in R a portion of the .xls associated with the following url. The .xls has two different spreadsheets. I want to import the table that starts in the 5th row in the second spreadsheets. An attempt is the following:

require(gdata)
url = "https://www.philadelphiafed.org/-/media/research-and-data/real-time-center/real-time-data/data-files/files/routput_first_second_third.xls?la=en.xls"
dataset = read.xls(url, sheet=2, header=T, skip=4)

The error that I get is:

Error in file.exists(tfn) : invalid 'file' argument

I'm working in Windows. The source of the .xls is here under the name "All available observations". You are very welcome use different packages.

Elrond
  • 347
  • 2
  • 15
  • 1
    As per http://stackoverflow.com/questions/21738463/importing-excel-file-using-url-using-read-xls, change https to http, and it will work. – jav Aug 03 '16 at 22:31

1 Answers1

0

First step is to download file then you can read it.

require(gdata)
url = "https://www.philadelphiafed.org/-/media/research-and-data/real-time-center/real-time-data/data-files/files/routput_first_second_third.xls?la=en.xls"

download.file(url, destfile="file.xls")

data<- read.xls("file.xls", header=TRUE, pattern="Rank", header=TRUE, sheet=2, skip=3)
Kush Patel
  • 3,685
  • 5
  • 42
  • 65
  • Running you code produce a NULL data. Anyway, data=read.xls("file.xls", header=TRUE, sheet=2, skip=3) does the trick. I suggest you to consider editing your answer with this line of code. Thank you very much! – Elrond Aug 03 '16 at 22:47