Xml 如何在googlesheets中使用XPath从kickstarter获取文本
我正试图从Kick Starter提取位置数据,以添加到现有数据集 目前,我正在使用GoogleSheets和XPath来获取各种元素,只是在位置的文本元素方面遇到了问题 它看起来如下所示:Xml 如何在googlesheets中使用XPath从kickstarter获取文本,xml,xpath,google-sheets,Xml,Xpath,Google Sheets,我正试图从Kick Starter提取位置数据,以添加到现有数据集 目前,我正在使用GoogleSheets和XPath来获取各种元素,只是在位置的文本元素方面遇到了问题 它看起来如下所示: A1 = https://www.kickstarter.com/projects/1201626825/tori-scott-live-at-the-edinburgh-fringe-festival?ref=home_new_and_noteworthy A2 = //a[@class="nowrap
A1 = https://www.kickstarter.com/projects/1201626825/tori-scott-live-at-the-edinburgh-fringe-festival?ref=home_new_and_noteworthy
A2 = //a[@class="nowrap navy-700 flex items-center medium type-12"]/text()
IMPORTXML(A1, $A$2)
奇怪的是,无论我是否输入text()
元素,我都会得到一个导入内容为空的错误
我还:
- 成功抓取了整个列表元素(提升状态、类别、位置)
- 尝试提取空内容错误的确切位置
- HTML中有两部分
。我不确定你想要的角色。在这里,我想提出两个部分@class=“nowrap navy-700 flex items center medium type-12”
- 它假定
位于单元格A1中https://www.kickstarter.com/projects/1201626825/tori-scott-live-at-the-edinburgh-fringe-festival?ref=home_new_and_noteworthy
- 这个答案怎么样?我认为对你的情况有几个答案。所以,请把这看作是其中之一
第1部分:
或
第2部分:
或
结果:
注:
如果我误解了你的问题,很抱歉。我的答案有用吗?你能告诉我这件事吗?这对我的学习也很有用。如果这样做有效,其他与你有相同问题的人也可以将你的问题作为可以解决的问题。
=INDEX(IMPORTXML(A1, "//div[@class='block-lg hide']//div[@class='NS_projects__badges mb3']//div[@class='border-top border-bottom border-top-none-md border-none-lg nested-full-width-xs nested-full-width-sm nested-full-width-md mb4 mb5-sm mb0-md']//div[@class='grid-row']//div[@class='col-sm-22-24 col-offset-sm-1-24 col-offset-md-0-24']//div[@class='py2 py3-lg flex']//div[@class='flex items-center auto-scroll-x']"), 6)
=INDEX(IMPORTXML(A1, "//div[@class='block-lg hide']//div//div//div//div//div//div"), 6)
=INDEX(IMPORTXML(A1, "//div[@class='col-full']//div[@class='NS_projects__badges mb3']//div[@class='border-top border-bottom border-top-none-md border-none-lg nested-full-width-xs nested-full-width-sm nested-full-width-md mb4 mb5-sm mb0-md']//div[@class='grid-row']//div[@class='col-sm-22-24 col-offset-sm-1-24 col-offset-md-0-24']//div[@class='py2 py3-lg flex']//div[@class='flex items-center auto-scroll-x']"), 6)
=INDEX(IMPORTXML(A1, "//div[@class='col-full']//div//div//div//div//div//div"), 6)
Edinburgh, UK