7

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?

1
  • anyone have any ideas about this?
    – Fablezim
    Commented Jan 16, 2018 at 21:02

1 Answer 1

4

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.

1
  • Incidentally this simpler formula works just the same: =SPARKLINE(GOOGLEFINANCE("GOOG", "price", TODAY()-7, TODAY())) I'm not quite sure how but sparkline() seems to figure it out
    – Ade
    Commented Feb 11, 2020 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.