Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GoogleFinance often returns #N/A and internal error messages while getting stock quotes

Anyone know workarounds to make GoogleFinance actually work? It works for a while so it is not a problem with my formulas but then periodically the cells that were showing stock quotes suddenly show "#N/A" and if you hover over them it shows that GoogleFinance experienced an internal error. It's really buggy. Changing the refresh interval doesn't help, in either direction. Anyone know workarounds to avoid the errors and have the spreadsheet simply show (and keep showing) the stock quote data without the errors?

like image 667
stackonfire Avatar asked Jan 22 '20 05:01

stackonfire


People also ask

How often is GOOGLEFINANCE updated?

Widgets powered by spreadsheets using the GOOGLEFINANCE function refresh approx. every 15 minutes. If this isn't fast enough for your needs – and your G Suite account allows it – you can write a script that can further reduce the refresh times.

Can I get dividend yield from GOOGLEFINANCE?

If you are looking to get the real-time dividend yield of any stock listed across 50+ covered exchanges, you can do so very simply by entering the function =WISE(“ticker”, “dividend yield”, “ttm”). As you can see, the function returns the latest dividend yield based on the last dividend payment and current stock price.

Is GOOGLEFINANCE real-time?

*Real-time price data represents trades which execute on the NASDAQ and NYSE exchanges. Volume information, as well as price data for trades that don't execute on those exchanges, are consolidated and delayed by 15 minutes.


2 Answers

you can either use alternative to GOOGLEFINANCE (depends on what exactly are you up to)

or if you want to stick with it you can wrap it into IFERROR:

=IFERROR(GOOGLEFINANCE(your_formula_here), GOOGLEFINANCE(same_formula_here))

or even:

=IFERROR(IFERROR(
 GOOGLEFINANCE(your_formula_here), 
 GOOGLEFINANCE(same_formula_here), 
 GOOGLEFINANCE(same_formula_here))
like image 126
player0 Avatar answered Nov 14 '22 20:11

player0


You could add a script to your spreadsheet (Tools/Script Editor) and use the CacheService (https://developers.google.com/apps-script/reference/cache) to cache Google Finance results. Cache data when it is available, use the cache when there is an error.

See https://developers.google.com/apps-script/quickstart/custom-functions for how to write custom functions for Google Sheets.

like image 23
Patrick Fournier Avatar answered Nov 14 '22 19:11

Patrick Fournier