ImportXML并替换进入的引号

时间:2016-04-28 11:39:45

标签: xpath google-sheets

我正在尝试将Google Play商店描述导入到Google电子表格中,这对于以下公式非常有效:

=importXML("https://play.google.com/store/apps/details?id=com.facebook.katana", "//div[@itemprop='description']")

但是,我遇到了这个问题:

Keeping up with friends is faster than ever.<p>• See what friends are up to...</p>

将被解析为:

"Keeping up with friends is faster than ever.• See what friends are up to..."

理想情况下,我希望将<p>标记替换为中断或至少一个空格。我一直在尝试以下公式

=importXML("https://play.google.com/store/apps/details?id=com.facebook.katana", "normalize-space(translate(//div[@itemprop='description'],'&quot;',' '))")

但这会删除&amp;,q,u,o,t和;

的每一次出现

如何为休息或空格替换这些HTML标记?

2 个答案:

答案 0 :(得分:1)

你实际上可以使用它:

=join(char(10),IMPORTXML("https://play.google.com/store/apps/details?id=com.facebook.katana","//*[@jsname='C4s9Ed']"))

为每个

元素提供换行符。请注意,对于第一个示例,如果要替换,则需要使用空格或换行来替换它。

如果你只想要一个空格而不是换行的新行,你可以改为char(10)改为" "

这是我尝试过的另一个App页面:

=join(char(10),IMPORTXML("https://play.google.com/store/apps/details?id=com.facebook.orca","//*[@jsname='C4s9Ed']")) 

答案 1 :(得分:0)

尝试:

=SUBSTITUTE(importXML("https://play.google.com/store/apps/details?id=com.facebook.katana", "//div[@itemprop='description']"), "•"," ")