In a recent post I described how to import current stock market data into your spreadsheet. You can, however, import historical data for a date range of your choice, allowing you to track the performance of your chosen stock.
To show historical data, we need to add some further parameters to the GoogleFinance() function call:
=GoogleFinance("symbol", "attribute", "start_date", ["num_days/end_date",] "interval")
“Symbol” and “attribute” are used as before.
“Start date” denotes the start of the tracking period.
“num_days”/”end_date” is an optional parameter, and can be either the end date of the analysis period, or the number of days from the start date. Enter anything lower than 50 and Google Sheets will consider it to be num_days, otherwise it is used as end_date. Omit the term altogether and you’ll see data for just one date, the start date quoted.
“interval” specifies whether to show the data daily or weekly – enter “Daily” or “1” for daily information, and “Weekly” or “7” for weekly prices.
In the figure, cell A1 contains:
=GoogleFinance("GOOG", "price", TODAY()-14, TODAY(), "Daily")
Note how the data has automatically been formatted into two columns below this cell.
I’ll get into how the chart is made in a future post.