[英]Any ideas why I cannot download this xlsx by R?
This is the page: https://ceegex.hu/en/market-data/daily-data?market_data_day_filter%5BstartDate%5D=2018-03-08&market_data_day_filter%5BendDate%5D=2018-03-30
这是页面: https://ceegex.hu/en/market-data/daily-data?market_data_day_filter%5BstartDate%5D=2018-03-08&market_data_day_filter%5BendDate%5D=2018-03-30
: https://ceegex.hu/en/market-data/daily-data?market_data_day_filter%5BstartDate%5D=2018-03-08&market_data_day_filter%5BendDate%5D=2018-03-30
where we got "download as xlsx" button. 在这里我们得到了“下载为xlsx”按钮。 The address of this button is: https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx
该按钮的地址是: https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx
: https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx
This address downloads a xlsx file. 该地址下载一个xlsx文件。 I want to do the same with R so I've written: download.file("https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx", "myfile.xlsx")
我想对R做同样的事情,所以写了: download.file("https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx", "myfile.xlsx")
but I got errors like Error in download.file
, cannot open URL
. 但是我Error in download.file
遇到诸如Error in download.file
, cannot open URL
。
The problem is that the file don't exist in the website, this is created when you press the button. 问题是该文件不存在于网站中,而是在您按下按钮时创建的。 Try it using the curl method: 使用curl方法尝试一下:
download.file("https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx",
"myfile.xlsx", method = "curl")
Try it this way. 尝试这种方式。
target = "https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx"
dest = 'downloaded_file.xls'
download.file(url = target, destfile = dest, mode='wb')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.