'IMPORTHTML on Google Sheets returning a #N/A error, but only in one document

I have a Google Sheets document where I track the prices of several stocks. I made this a couple of months ago, and have been experiencing this issue for the past couple of weeks:

This formula returns "#N/A", the error description is: "Could not fetch url: https://finviz..."

=substitute(INDEX(IMPORTHTML("https://finviz.com/quote.ashx?t=VOO","table",11),8,2),"*","")

However, if I create a new Google Sheets document and use this exact formula, it works. Does anyone know what could be the problem?



Solution 1:[1]

I am having the same issue. Something must have been changed at finviz / google :( There are also some discussions in the google support groups. One possible solution could be to put all the symbols you're interested in into one URL, e.g. https://finviz.com/screener.ashx?v=161&t=FB,AAPL,GOOG,TSLA&ta=0&p=w and then parse the resulting table. Unfortunately I am not very good at the parsing part and have to do it by try and error. But for example

=importxml("https://finviz.com/screener.ashx?v=161&t=FB,AAPL,GOOG,TSLA&ta=0&p=w";"//*[@id='screener-content']/table/tbody/tr[4]/td/table")

is at least showing some results in google docs. So this might be something to work with.

Solution 2:[2]

It will work again by removing 'SUBSTITUTE' and switching to table 8. A2 = stock ticker

=ÍNDICE(IMPORTHTML("https://finviz.com/quote.ashx?t="&A2;"table";8);7;2)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RazzleDazzle
Solution 2 Rene Etiene