How can I fetch current weekly closing price of a stock in google sheet?
I have tried using the formula GOOGLEFINANCE("GOOG", "price", TODAY(), TODAY(), "WEEKLY")
.
But its showing no results.
=GOOGLEFINANCE("NASDAQ:GOOGL", "close",TODAY()-60,TODAY(),"WEEKLY")
You can adjust the TODAY()-60
to a start date DATE(2019,1,1)
for example:
=GOOGLEFINANCE("NASDAQ:GOOGL", "close",DATE(2019,1,1),TODAY(),"WEEKLY")
or how you'd like to do it. It might update the current week in real time if you use "price"
instead of "close"
, not sure since it's the weekend, and so nothing is ticking or updating right now.
Since it appears you just want a single result of the most recent weeks closing price, try this:
=INDEX(GOOGLEFINANCE("NASDAQ:GOOGL","price",TODAY()-14,TODAY(),"WEEKLY"),3,2)
Improved the integer for the one above, but it could still theoretically break.
Try this instead, as it gives a 30 day range but only selects the result from within 1 week:
=INDEX(QUERY(GOOGLEFINANCE("NASDAQ:GOOGL","price",TODAY()-30,TODAY(),"WEEKLY"),"select Col2 where Col1 < date'"&TEXT(TODAY(),"yyyy-mm-dd")&"' and Col1 > date'"&TEXT(TODAY()-7,"yyyy-mm-dd")&"' limit 1"),2)
Hope that (finally) helps!