Google-sheets – Stock Sparkline for today/hourly

google sheetsgoogle-finance

I am trying to make a sparkline graph in Google Sheets that tracks the stock price of TODAY using google finance as time progresses. For example, at 8am it would show the opening price, and by close there would be a graph of that days rise/fall progress. I'm wondering if this is possible, as I've tried many variations of the following formula (which I am using for 3, 7, 14, 30, and 1 year graphs), but I cannot seem to integrate the TIME(), TODAY(), or NOW() at all and don't know how to move forward from here.

Here is the formula for my other sparklines:

=SPARKLINE(GOOGLEFINANCE($F6,"price",TODAY()-1,TODAY(),"DAILY"),{"charttype",K12;"linewidth",2;"color","#6d4600"})

…where F6 is the stock ticker, K12 is "line", and the -1 is changed to the timeline I want for the graph (ie. -7 is a week.) Anyone have any ideas to make this work?

Best Answer

GoogleFinance function does not provide hourly data (source: its documentation). For today, one can only get the current (delayed) price, opening price, and the high and low marks so far. Can't make a sparkline out of this.

For an interval of several days, one can make a sparkline as follows:

=sparkline(query(googlefinance("GOOG", "price", today()-7, today()), "select Col2 label Col2 ''", 1))

For historical data, googlefinance returns a table. The query selects the second column of the table (prices) and omits its header (`label Col2 ''). Then the sparkline is created out of that.