0
=importXML("https://soundcloud.com/michael-barrera-24/tracks","//*[@class='infoStats__value sc-font-tabular-light']")

This is what I am using in the cell now. The website link is here: https://soundcloud.com/michael-barrera-24

I am trying to return how many follows I have. I am trying to stay updated with google sheets. It should return 13. Thanks for the help!

Andersson
  • 51,635
  • 17
  • 77
  • 129

3 Answers3

1

Based on your comment to some of the other answers - one of the bigger reasons it doesnt work is because of the URL, your missing the protocol:

http:// - google sheets wont process your importxml without it being an absolute URL and the best xpath to get is this one:

//meta[@property='soundcloud:follower_count']/@content

=IMPORTXML("https://soundcloud.com/michael-barrera-24","//meta[@property='soundcloud:follower_count']/@content")

enter image description here

Aurielle Perlmann
  • 5,323
  • 1
  • 15
  • 26
0

If you want XPath to return 13, try

//div[@class="infoStats__value sc-font-tabular-light"]/text()
Andersson
  • 51,635
  • 17
  • 77
  • 129
0

This page has three div elements matching your xpath expression. You can point to particular div element you want to retrieve like this:

//a[contains(@href, "followers")]/div/text()

or you can slightly adjust your xpath just add parentheses and specify you want a first div:

(//*[@class='infoStats__value sc-font-tabular-light']/text())[1]
vold
  • 1,549
  • 1
  • 13
  • 19
  • So I tried both ways and they looked like this: =importXML("https://soundcloud.com/michael-barrera-24","//a[contains(@href, 'followers')]/div/text()") and =importXML("https://soundcloud.com/michael-barrera-24","(//*[@class='infoStats__value sc-font-tabular-light']/text())[1]") But I am getting a #N/A in google sheets. The imported content is empty. – Michael Barrera Mar 19 '17 at 18:04
  • Xpath expression is valid but the page contents you see in your browser is generated by javascript, and Google spreadsheet doesn't execute js. See this [answer](http://stackoverflow.com/questions/20766174/importxml-parse-error) – vold Mar 19 '17 at 20:04