Xpath 如何在Google表中创建IF以匹配非布尔值?
我有一个url,比如,我有不同的节点,比如Xpath 如何在Google表中创建IF以匹配非布尔值?,xpath,google-sheets,google-sheets-formula,Xpath,Google Sheets,Google Sheets Formula,我有一个url,比如,我有不同的节点,比如 <1> <desc>one two</desc> <link>three four</link> </1> <2> <desc>five six</desc> <link>seven eight</link> </2> <3> <desc>ni
<1>
<desc>one two</desc>
<link>three four</link>
</1>
<2>
<desc>five six</desc>
<link>seven eight</link>
</2>
<3>
<desc>nine ten</desc>
<link>eleven twelwe</link>
</3>
但是你会得到这个错误
Function IF parameter 1 expects boolean values. But 'two' is a text and cannot be coerced to a boolean.
这个=importxml(A1,“//*[包含(text(),'approvement')]|//链接”)
也以一个错误结束:
Array result was not expanded because it would overwrite data in C2.
今天运气不好…我终于成功了:
=importxml(A1,"//*[contains(.,'two')]/desc") =importxml(A1,"//*[contains(.,'two')]/link")
最后,这对我起了作用:
=importxml(A1,"//*[contains(.,'two')]/desc") =importxml(A1,"//*[contains(.,'two')]/link")
如果您能够在google sheets中使用正则表达式,您可以尝试以下方法。我只在描述中搜索两个匹配项,如果存在匹配项,则捕获描述和链接文本<代码>(?如果您能够在google sheets中使用正则表达式,您可以尝试以下操作。我只在描述中搜索两个匹配项,如果存在匹配项,则捕获描述和链接文本。
(?)?