From this
From this
From this

Parse tag in html via Google Sheets (importxml)

39 Views Asked by At

in this website : https://www.tankathon.com/mock_draft

I want to retrieve the tag href="/players/zaccharie-risacher">

From this

<div class="mock-row-player">
   <a class="primary-hover" href="/players/zaccharie-risacher">
      <div class="mock-row-name">Zaccharie Risacher</div>
      <div class="mock-row-school-position">SF | JL Bourg </div>
   </a>
</div>

I’ve tried

//a[@href/contains("players")]

with no success

1

There are 1 best solutions below

2
Tanaike On BEST ANSWER

In your situation, how about the following formula?

Sample formula:

=IMPORTXML("https://www.tankathon.com/mock_draft","//a[contains(@href,'players')]")

In this modification, //a[@href/contains("players")] is modified to //a[contains(@href,'players')].

Testing:

When this formula is used, the following result is obtained.

enter image description here

Added:

From your following reply,

I’m not looking for : Zaccharie Risacher // SF | JL Bourg, but really looking for the tag "/players/zaccharie-risacher", is it possible?

About the tag "/players/zaccharie-risacher", the following formula is your expected one?

=IMPORTXML("https://www.tankathon.com/mock_draft","//a[contains(@href,'players')]/@href")

enter image description here