Google sheets - How to make a sparkline for a stock using Google Finance

Today I decided to add some sparklines to my personal spreadsheet that I use to keep track of my stocks. These are small graphs that are contained within a cell of your spreadsheet. All of the tickers mentioned in this post are just examples, this is not a recommendation to buy or sell any of them - but I might hold positions in them.

NOTE: I have added European (Danish) syntax examples at the bottom of the page. Basically this is replacing , with ; and , with \. It is very frustrating finding examples that are not in your locale, I hope this helps however.

How to show a one year or one month sparkline

Using the two below functions you can get a tiny graph of Alibaba's (9988) stock price for the last 30 days and 365 days:

One year:
=SPARKLINE(GOOGLEFINANCE("HKG:9988","price",TODAY()-365,TODAY(),
"Weekly"),{"charttype","line";"linewidth",2;"color","green"})

One month:
=SPARKLINE(GOOGLEFINANCE("HKG:9988","price",TODAY()-30,TODAY(),
"Daily"),{"charttype","line";"linewidth",2;"color","purple"})

You can show any other stock that Google finance has support for, some examples could be: NASDAQ:AAPL, NYSE:MMM, HEL:NOKIA. All you have to do is replace "HKG:9988" with the ticker you want a sparkline for. It is a good practice to prefix with the exchange (HKG: for example) as tickers are not unique across exchanges. This is probably not that big of an issue if you only trade american companies.

It will look like the following (one year is purple and one month is green):

google-sheet-sparkline-example

Danish (European?) syntax

Depending on the locale of your sheet you might have a different syntax for functions. As someone from Denmark this is the syntax I use:

One year:
=SPARKLINE(GOOGLEFINANCE("HKG:9988";"price";TODAY()-365;TODAY();
"Weekly");{"charttype"\"line";"linewidth"\2;"color"\"green"})

One month:
=SPARKLINE(GOOGLEFINANCE("HKG:9988";"price";TODAY()-30;TODAY();
"Daily");{"charttype"\"line";"linewidth"\2;"color"\"purple"})

That is it!

I hope you have your sparklines up and running by now :) Let me know in the comments down below if you have any difficulties.