Invorthtml用Google表刮擦Wiki表的特定列

发布于 2025-02-10 15:48:07 字数 135 浏览 2 评论 0原文

我正在尝试使用sheet中的ImporthTML+查询从Wiki表中刮擦一个特定的列(如果存在),但似乎并不总是有效。在某些情况下,当列缺失时,它仍然会返回其他数据(而不是空输出),在其他情况下,它提取了多个列。有人知道这样做的更好的方法吗?谢谢。 请参阅

I'm trying to scrape one specific column from Wiki table (if it exists), using IMPORTHTML+QUERY in sheets, but it doesn't always seem to work. In some cases when the column is missing it still returns data from other ones (instead of empty output), in other cases, it extracts multiple columns. Does anyone know a better way of doing this? Thanks.
See examples

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只等公子 2025-02-17 15:48:07

尽管我不确定我是否能正确理解您的问题,但是,以下样本公式如何?在此修改中,我使用importxml而不是Importhtml

样品公式:

=IFERROR(JOIN(" ",IMPORTXML(A2,"//tr[./th[text()='Died']]/td")))

测试:

当此样品公式用于您提供的样品电子表格时,将获得以下结果。

注意:

  • 在此示例公式中,我仅使用您的显示URL进行了测试。因此,我不确定是否可以将此示例公式用于您的所有预期URL。

参考:

Although I'm not sure whether I could correctly understand your question, for example, how about the following sample formula? In this modification, I used IMPORTXML instead of IMPORTHTML.

Sample formula:

=IFERROR(JOIN(" ",IMPORTXML(A2,"//tr[./th[text()='Died']]/td")))

Testing:

When this sample formula is used for your provided sample Spreadsheet, the following result is obtained.

enter image description here

Note:

  • In this sample formula, I tested with only your showing URLs. So, I'm not sure whether this sample formula can be used for your all expected URLs.

Reference:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文