gpt4 book ai didi

xpath - 如何在 Google 电子表格中使用 ImportXML 返回多列数据?

转载 作者:行者123 更新时间:2023-12-04 22:52:22 24 4
gpt4 key购买 nike

我正在使用 ImportXML在 Google 电子表格中访问 user_timeline method in the Twitter API .我想提取 created_attext响应中的字段并创建结果的两列显示。

目前我通过调用 API 两次来做到这一点,

=ImportXML("http://twitter.com/status/user_timeline/matthewsim.xml?count=200","/statuses/status/created_at")

在一列顶部的单元格中,以及
=ImportXML("http://twitter.com/status/user_timeline/matthewsim.xml?count=200","/statuses/status/text")

在另一个。

有没有办法让我通过一次调用来创建这个显示?

最佳答案

ImportXML 支持使用 xpath |分隔符以包含任意数量的查询。

=ImportXML("http://url"; "//@author | //@catalogid| //@publisherid")

但是,它不会将结果扩展为多列。您将获得一列重复的三元组(或您选择的许多属性),如下面的 A 列所示。 .

以下内容已弃用

2015.06.16: continue在“新的 Google 表格”中不可用(请参阅: Google Documentation for continue)。

但是您不需要使用自动插入的 CONTINUE()功能来放置您的结果。
=CONTINUE($A$2, (ROW()-ROW($A$2)+1)*$A$1-B$1, 1)

置于 B2这应该干净利落地填写并正确地为您提供合理的列数据。

example screenshot
  • ImportXML 在 A2 .
  • A3及以下是如何 CONTINUE()函数会自动填充。
  • A1是属性的数量。
  • B1:D1是其列的属性索引。
  • 关于xpath - 如何在 Google 电子表格中使用 ImportXML 返回多列数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2774671/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com