2
votes

I'm trying to import data from Yahoo Finance into a spreadsheet.

If I enter this in Excel...

=WEBSERVICE("https://finance.yahoo.com/quote/GOOG/")

...it returns a #VALUE! error because the content of the page exceeds the character limit for a single cell.

I only need the Yahoo Finance value listed after "Previous Close." Since this amount--presently 987.83--is well below the Excel cell character limit, is there a way to modify the function to return just that amount?

Thanks!

1

1 Answers

2
votes

In my opinion, WEBSERIVCE is used more along the lines of retrieving JSON or some sort of API endpoint. Your trying to parse an entire HTML page. So yes, you can use WEBSERIVCE to scrap content, but your specific page is returning too much data to handle.

Per the remarks here:

  • If arguments result in a string that is not valid or that contains more than the allowable cell limit of 32767 characters, WEBSERVICE returns the #VALUE! error value.
  • If url is a string that contains more than the 2048 characters that are allowed for a GET request, WEBSERVICE returns the #VALUE! error value.

I would suggest using a traditional Query where you can manipulate the webpage as desired.

And then you can grab the table as depicted below. Further more, this content will refresh dependent on the settings you allow:

snapshot