excel - 我可以使用 Excel WEBSERVICE 从页面中抓取特定内容吗?

标签 excel web-services web-scraping

我正在尝试将数据从雅虎财经导入到电子表格中。

如果我在 Excel 中输入此内容...

=WEBSERVICE("https://finance.yahoo.com/quote/GOOG/ ")

...它返回#VALUE!错误,因为页面内容超出了单个单元格的字符限制。

我只需要“上一次收盘价”后列出的雅虎财经值。由于该金额(目前为 987.83)远低于 Excel 单元格字符限制,是否有办法修改函数以仅返回该金额?

谢谢!

最佳答案

在我看来,WEBSERIVCE 更多地用于检索 JSON 或某种 API 端点。您尝试解析整个 HTML 页面。所以,是的,您可以使用WEBSERIVCE来废弃内容,但您的特定页面返回的数据太多而无法处理。

根据备注here :

  • If arguments result in a string that is not valid or that contains more than the allowable cell limit of 32767 characters, WEBSERVICE returns the #VALUE! error value.
  • If url is a string that contains more than the 2048 characters that are allowed for a GET request, WEBSERVICE returns the #VALUE! error value.

我建议使用传统的 Query 您可以在其中根据需要操作网页。

然后您可以获取如下所示的表格。此外,此内容将根据您允许的设置刷新:

snapshot

关于excel - 我可以使用 Excel WEBSERVICE 从页面中抓取特定内容吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46751066/

相关文章:

java - 使用 Apache POI 在 Microsoft Excel XSSF 中存储电话号码

java - 在一台计算机上测试大量 Web 服务

javascript - YouTube API - 抓取视频上传日期

python - 如何使用 python 在 PowerBI 中将 .pbix 文件转换为 Excel

vba - Excel VBA : Sent Outlook email does not include pasted Range

xml - 如何使用 Axis2 和 Rampart 在 SOAP 请求中添加 MessageID

web-services - RESTful 服务中的自定义操作

python - 使用多个 token 发布 CSRF token ?

internet-explorer - IE 11 的内存泄漏,而 Google Chrome 不会发生

VBA使用登录名和密码从网站下载csv文件