=IMPORTXML 没有导入预期的内容

=IMPORTXML Not importing what is expected

我正在尝试将部门和行业标签导入 google 文档。

我正在使用...

=IMPORTXML("https://finance.yahoo.com/quote/ABT/profile?p=ABT","//span[@data-reactid='21']")

显示在三个不同的单元格中:

Profile
Healthcare
About Our Ads

但我想要的只是一个牢房里的医疗保健

=IMPORTXML("https://finance.yahoo.com/quote/ABT/profile?p=ABT","//span[@data-reactid='25']")

显示在三个不同的单元格中:

Financials 
Medical Devices 
Sitemap

但我只想要一个牢房里的医疗设备

我的语法有什么问题?

我认为您还有另外两行 span - 因此是三行而不是一行。

您可能想要使用更精确的 xpath,例如:

=IMPORTXML(
  "https://finance.yahoo.com/quote/ABT/profile?p=ABT",
    "//p/span[text()='Sector']/following-sibling::span[1]/text()")

=IMPORTXML(
  "https://finance.yahoo.com/quote/ABT/profile?p=ABT",
    "//p/span[text()='Industry']/following-sibling::span[1]/text()")