Reputation: 1676
I can use following code in Google Spreadsheet to retrieve a specific <span>
element on that html-document.
=IMPORTXML("https://finance.yahoo.com/quote/NBIX201218C00125000?p=NBIX201218C00125000";"//td[@data-test='PREV_CLOSE-value']/span")
But this returns the error message that the returned content is empty.
So how do I retrieve the content (in this example the text '17.00') of this HTML-element in the spreadsheet?
Upvotes: 0
Views: 3084
Reputation: 5915
Use IMPORTFROMWEB
addon (number of requests are limited in the free plan) to get this.
//td[@data-test='PREV_CLOSE-value']/span
Formula in C5 :
=IMPORTFROMWEB(C1;C2)
Upvotes: 2
Reputation: 127
Maybe this is because of the consent manager on Yahoo, that is shown before you get to the actual page.
When I downloaded the page, after checked the consent, put in on my server and use your code in Google Spreadsheets it is working.
Upvotes: 0