简体   繁体   中英

How to import price value to Google Sheets from a website using ImportXML function?

I'm trying to use ImportXML on Google Sheets to import a price value from a website. Can't find the right XPATH. Please help!

I tried this line and various others and they didn't work:

=importxml("http://www.bizportal.co.il/mutualfunds/quote/giusimandpedionot/5124573","//div[@class='top-area-cube']//num()")

This is the relevant source of the page I'm trying to extract (I want the value 117.3 , under the data-row mutual-funds"/"top-area-cube"/"num section).

    <a class="add-to-portfolio " href="javascript:void(0);" onclick="portfolio.addPaper('5124573',this)" data-paper-added="0" data-user-logged="0" data-paper-id="5124573" data-name="quote-paper">
        <span class="label">הוסף לתיק אישי</span>
        <span class="icon-case2"></span>
    </a>
<h1 class="data-row">
    <span class="paper-name">תכלית MSCI WORLD TTF</span>
</h1>
    <div class="data-row mutual-funds">
        <div class="top-area-cube">
            <div class="label">מחיר פדיון</div>
            <div class="num">117.33</div>
        </div>
        <div class="top-area-cube">
            <div class="label">מחיר קנייה</div>
            <div class="num">117.33</div>
        </div>

        <span class="num percent rise"><span>0.35%</span><span class="icon icon-up"></span></span>
        <span class="num percent points-container rise"></span>
    </div>
    <div class="statistics-container">
        <ul class="row data-row statistics">
            <li><span class="label">% החודש:</span><span class="num rise">3.69%</span></li>
            <li><span class="label">% השנה:</span><span class="num rise">14.33%</span></li>
            <li><span class="label">% 3 חודשים:</span><span class="num rise">8.51%</span></li>
            <li><span class="label">% 12 חודשים:</span><span class="num rise">6.74%</span></li>
            <li><span class="label">סטיית תקן (שנה):</span><span class="num">12.11</span></li>
            <li><span class="label">שארפ (שנה):</span><span class="num">0.54</span></li>
        </ul>
    </div>

The expected results are the value 117.33 (or any other value under this specific node) to return to the google sheets file.

The current result is #N/A

不幸的是,该网站无法使用任何IMPORT公式进行抓取,最有可能是由于他们为宣传API而进行的反抓取测量

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM