Pulling plain text using importxml on Google Sheets

1.1k views Asked by At

Im still a novice so please bear with me on this...

I'm attempting to use an importxml formula to pull an up to the minute price from a retail website. The price is displayed in plain text within the source code as follows.

    <tr id="itemDetailsDiv">
      <td colspan="2" align="left" style="display: table; width: 100%; padding: 0px;">
        <table width="100%" cellspacing="0" cellpadding="0" border="0">
          <tr valign="top">
            <td id="sellTitle" class="productInfoCat priceInfo bold right">WeSell for</td>
            <td id="Asellprice" class="productInfo priceInfo sellPrice">£8.00</td>
          </tr>
          <tr style="display: none;">...</tr>
          <tr valign="top">...</tr>
          <tr valign="top">...</tr>
          <tr valign="top" class="greenBtmBordr top" style="border-bottom: 0px;">...</tr>
        </table>
      </td>
    </tr>

What I'm specifically trying to pull is the text saying "£8.00" and Im using the following xpath query.

    "//span[@id='Asellprice']/text()"

Clearly I'm going wrong somewhere but I'm very much an amateur and I can't see the problem. If you need any more info please just let me know.

Thanks :)

1

There are 1 answers

0
B-Money On

I believe the correct xpath would look like this.

//td[@id='Asellprice']