R直接从Web导入Excel文件 [英] R Importing excel file directly from web
问题描述
I need to import excel file directly from NYSE website. The spreadsheet url is https://quotespeed.morningstar.com/exportChartDataToExcel.jsp?tickers=AAPL&symbols=126.1.AAPL&st=1980-12-1&ed=2015-6-8&f=m&dty=1&types=1&ver=1.6.0&qs_wsid=E43474CC03753FE0E777D89877788ECB . Tried using gdata package and changing https to http but still doesnt work. Does anybody know solution to such issue?
必须直接从网站导入R(项目要求)
Has to be imported to R directly from website (project requirement)
推荐答案
没有关于为什么使用 gdata
包对您不起作用的信息,我不得不假设.确保已安装 Perl
-您可以从 http://www.activestate下载.com/activeperl
Without information about why using the gdata
package does not work for you I have to assume. Make sure you have Perl
installed - you can download it at http://www.activestate.com/activeperl
这对我有用:
library('gdata')
## URL broken into multiple lines for readability
url <- paste("https://quotespeed.morningstar.com/exportChartDataToExcel.",
"jsp?tickers=AAPL&symbols=126.1.AAPL&st=1980-12-1&ed=2015-",
"6-8&f=m&dty=1&types=1&ver=1.6.0&qs_wsid=E43474CC03753FE0E",
"777D89877788ECB", sep = "")
url <- gsub("https", "http",url)
data <- read.xls(url, perl = "C:/Perl64/bin/perl.exe")
没有 perl ="path_to_perl.exe"
我收到了错误
Error in findPerl(verbose = verbose) :
perl executable not found. Use perl= argument to specify the correct path.
Error in file.exists(tfn) : invalid 'file' argument
这篇关于R直接从Web导入Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!