0

Trying to scrape a specific price for google sheets. The element is

<div class="col-sm-6 col-xs-6 text-center bg-grey2 brd_rht pad_none" id="id11">102.4</div>

while the xpath is

//*[@id="id11"]

By using

 =IMPORTXML("http://www.funder.co.il/fund.aspx?id=5122973","//*[@id="id11"]")

I get an #ERROR! sign. I'm quite new to using xpath, so would be glad to know what is wrong with what I did, and how is it possible to get the number 102.4 into google sheets.

1 Answer 1

1

You're getting #ERROR! because of the " around id11; they conflict with the quotes being used in the formula. Instead use single quotes ' around id11.

Your xpath selector should be //div[@id='id11']/text(). You can test here.

NOTE: Even with those changes, this won't work. If you visit the source of the link you're trying to pull data from and search for id11, you'll see that there is no value.

<div class="col-sm-6 col-xs-6 text-center bg-grey2 brd_rht pad_none" id="id11"></div>

This is because the data is added via jQuery when you load the page on your browser, so you won't be able to access it using IMPORTXML(). If you can figure out where that data might be coming from originally, you might be able to try this approach with that new source.

Sign up to request clarification or add additional context in comments.

2 Comments

The source is from here, and I'm pretty sure the data is in the source here. Element <td class="IndexesValuesRed">102.4</td>. Still, using the xpath, I don't manage to make this work.
@Nashh Sorry, but I think you'll need to post another question. I'm not very familiar with xpath, and this is will require a more complicated query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.