本文介绍了使用ImportXML来拉取包含字符串的链接的URL和锚点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Google表格中使用ImportXML来提取包含该字符串的链接的URL和锚点。问题是我想避免让字符串硬编码并希望它从另一个单元格中提取。
I'm trying to use ImportXML in Google Sheets to pull URL and anchor of link containing the string. Problem is that I want to avoid having string hardcoded and want it to be pulled from another cell.
硬编码示例:
=IMPORTXML("http://www.debian.org/mirror/list", "//a/@href[contains(., 'about')]")
预期结果(使用 A2 代替 约):
Desired outcome (using A2 instead of about):
=IMPORTXML("http://www.debian.org/mirror/list", "//a/@href[contains(., A2)]")
I尝试将A2放在引号中,但这不起作用。
I tried putting A2 in quotes but that didn't work.
推荐答案
请尝试:
=IMPORTXML("http://www.debian.org/mirror/list", "//a/@href[contains(.,'"&A2&"' )]")
即单引号(如前所述)围绕<$ c左右的双引号$ c>& s。
ie single quotes (as before) around double quotes around &
s.
这篇关于使用ImportXML来拉取包含字符串的链接的URL和锚点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!