将importxml限制为定义的跨度 [英] Limit the importxml to a defined span

查看:145
本文介绍了将importxml限制为定义的跨度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用转置,然后是另一列来计算结果并给我我想要的。但是因为Tanaike非常棒,并且在另一部分帮助我,所以我试图围绕他所做的并将其应用于此。



从A1中的此URL开始,

  https://www.zillow.com/homedetails/307-N-Rosedale-Ave-Tulsa-OK-74127 / 22151896_zpid / 

这是A2中的公式:

  = If($ A $ 1:A =,,Transpose(importxml($ A1:$ A,// span [@ class ='snl phone' ])))

有时有三个电话号码,有时是四个,有时八根根据需要分布在尽可能多的列中。



我正在寻找Property Owner电话号码。这是检查中的ELEMENT。

 < div class =info flat-star-ratings sig-colid = yui_3_18_1_2_1506365934526_2361 > < span class =snl name notranslate>属性所有者< / span> < span class =snl phoneid =yui_3_18_1_2_1506365934526_2360>(918)740-1698< / span> < / DIV> 

所以我试了一下,内容是空的。我正在考虑看看div class info flat,然后在snl phone内,并在span / end结束之前停止。

  = importXML(B17,// div [@ class ='info flat-star-ratings sig-col'] // span [@ class ='snl phone'] / @ span)

我真正需要的是只有属性所有者电话号码,其准确率达到95%或更高。
< DIV类= h2_lin>解决方案

如何XPath查询的该变形例



改性XPath查询:<?/ H2>

  = importxml(A1,// div [@ class ='info flat-star-ratings sig-col'] // span [@ class =' snl phone'])



结果:



在这里输入图片描述



如果这不是您想要的数据,我很抱歉。



编辑:



<4>和第8个数字相同。我的理解是否正确?如果没问题。请分别把URL和以下公式 A1 和 A2,...



  = QUERY(ARRAYFORMULA(IF(IMPORTXML (A1,// div [@ class ='info flat-star-ratings sig-col'] // span [@ class ='snl name notranslate'])=Property Owner,IMPORTXML(A1,/ / div [@ class ='info flat-star-ratings sig-col'] // span [@ class ='snl phone']),)),Select * where Col1<>') 



结果:



输入图像description


Currently I am using a transpose and then another column to count the results and give me what I want. But because Tanaike is awesome and helped me on another section, I am trying to wrap my head around what he did and apply it to this.

Starting with this URL in A1,

https://www.zillow.com/homedetails/307-N-Rosedale-Ave-Tulsa-OK-74127/22151896_zpid/

This is the formula in A2:

=If($A$1:A="","",Transpose(importxml($A1:$A,"//span[@class='snl phone']")))

Based on the listing sometimes there are three phone numbers, sometimes four, and sometimes eight that get spread across as many columns as needed.

I am looking for the Property Owner phone number. This is the ELEMENT from the inspection.

<div class="info flat-star-ratings sig-col" id="yui_3_18_1_2_1506365934526_2361">  <span class="snl name notranslate">Property Owner</span>           <span class="snl phone" id="yui_3_18_1_2_1506365934526_2360">(918) 740-1698 </span>    </div>

So I tried this, and it comes up content is empty. I was thinking to look at the div class info flat, then within that the snl phone, and stop before the /end of span.

=importXML(B17,"//div[@class='info flat-star-ratings sig-col']//span[@class='snl phone']/@span")

What I really need is ONLY the property owner phone number with 95% or greater accuracy.

解决方案

How about this modification of XPath query?

Modified XPath query :

=importxml(A1,"//div[@class='info flat-star-ratings sig-col']//span[@class='snl phone']")

Result :

If this is not data you want, I'm sorry.

Edit :

4th and 8th number are the same. Is my understanding correct? If it's no problem. Please put URL and a following formula to "A1" and "A2", respectively.

=QUERY(ARRAYFORMULA(IF(IMPORTXML(A1,"//div[@class='info flat-star-ratings sig-col']//span[@class='snl name notranslate']")="Property Owner",IMPORTXML(A1,"//div[@class='info flat-star-ratings sig-col']//span[@class='snl phone']"), "")),"Select * where Col1<>''")

Result :

这篇关于将importxml限制为定义的跨度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆