ImportXML错误:无法解析导入的XML内容

时间:2019-10-07 17:21:21

标签: google-sheets google-sheets-formula array-formulas google-sheets-query google-sheets-importxml

该公式在某些页面上无法正常运行。

我可以通过以下方法加载产品名称和价格,仅与URL和类名称不同。

=IMPORTXML("https://mall.han-don.com/goods/goods_list.php?cateCd=001002","//*[@class='prdName']//text()")

但是,它没有加载“无法解析导入的XML内容”。消息。

1 个答案:

答案 0 :(得分:1)

使用此:

=ARRAYFORMULA(REGEXEXTRACT(QUERY(SUBSTITUTE(ARRAY_CONSTRAIN(IMPORTDATA(
 "https://mall.han-don.com/goods/goods_list.php?cateCd=001002"), 10000, 1), """", ), 
 "where Col1 contains 'strong class=prdName>'"), ">(.+)</strong"))

0


=ARRAYFORMULA(QUERY({{"";"";SUBSTITUTE(ARRAY_CONSTRAIN(IMPORTDATA(
 "https://mall.han-don.com/goods/goods_list.php?cateCd=001002"), 10000, 1), """", )}, 
 {ARRAY_CONSTRAIN(IMPORTDATA(
 "https://mall.han-don.com/goods/goods_list.php?cateCd=001002"), 10000, 1);"";""}}, 
 "select Col2 where Col1 contains 'span class=cost prdPrice'")&".000원")

0