r - 有什么想法为什么我不能用 R 下载这个 xlsx?
问题描述
这是页面:
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
我们在哪里得到“下载为 xlsx”按钮。这个按钮的地址是:
https://ceegex.hu/en/market_data/day/export.xlsx?startDate=2018-03-08&endDate=2018-03-30&_format=xlsx
此地址下载 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")
但我得到了像Error in download.file
,之类的错误cannot open URL
。
解决方案
问题是该文件在网站中不存在,这是在您按下按钮时创建的。尝试使用 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")
推荐阅读
- python - Web Scraping (Python) 多请求运行时间太慢
- r - 多选所有按钮导致闪亮地图中的交互性问题
- caching - 使用 Redis Pub/Sub 将数据持久化到 RDBMS
- angular - 如何刷新Angular中函数返回的参数
- python - 如果它不是空白、NaN 或空,还有什么可能?
- php - 为什么 php 在尝试连接到本地套接字服务器时会挂起?
- rust - 如何在 Rust 中使用返回类型为 impl trait 的 Fn 特征?
- sql - 使用案例语句获取每周总订单数、已取消订单数和已取消订单百分比
- python - 如何在 tkinter 中使用 PIL 图像
- java - 从 DER ApplicationSpecific 对象获取可读数据