I'm trying to fetch part of a single table from an HTML page into my Google spreadsheet. Been having lots of problems. importhtml()
fails quite regularly (but not always) and simply displays "loading..." forever. So I decided to try UrlFetchApp()
instead. Having problem with it as well.
Here is the URL I'm trying to fetch:
http://finance.yahoo.com/quote/COH160916P00041000?p=COH160916P00041000
My importhtml()
version is simply:
=index(IMPORTHTML("http://finance.yahoo.com/quote/COH160916P00041000?p=COH160916P00041000","table",1),3,2)
As I mentioned this does work... mostly. But it breaks too often to be dependable. How can I accomplish the same thing using UrlFetchApp()
?
I just discovered something very strange related to this. This formula works fine:
=IMPORTHTML("http://finance.yahoo.com/quote/coh160916P00040000","table",1)
This displays "Loading..." indefinitely:
=IMPORTHTML("http://finance.yahoo.com/quote/COH160916P00040000","table",1)
The only difference is the capitalization of "COH" in the second one. That is the correct URL on Yahoo's site:
http://finance.yahoo.com/quote/COH160916P00040000
So what gives?
http://webapps.stackexchange.com/questions/97409/google-sheets-do-named-ranges-not-work-under-certain-conditions
however, my example in this question does work most of the time, it just fails sometimes and I don't know why.