How to get stock prices in Google Sheets
You can watch a video tutorial here.
Google Sheets has many uses in the financial industry, the stock market in particular. Financial analysts can use Google Sheets to track the prices of stocks in real-time or to extract historical prices. This is done by linking it to Google Finance which is an application that provides real-time and historical stock prices from around the world. Google Sheets uses the GOOGLEFINANCE() function to extract data from Google Finance.
- GOOGLEFINANCE(): this fetches current or historical financial securities information from Google Finance
- Syntax: GOOGLEFINANCE(symbol, attribute, start date, end date/no. of days, interval)
- Symbol: the ticker symbol of the security. It is better to use the exchange symbol as well to ensure accuracy
- attribute (optional): the attribute to be fetched e.g. current price, open, high, low
- start date(optional): the date from which the data is to be fetched for historical data
- end date/no. of days (optional): when the start date is given, the end date or the number of days from the start date is to be given as well
- interval (optional): either 1 or 7 to return the frequency of the data i.e. Daily or Weekly
- Syntax: GOOGLEFINANCE(symbol, attribute, start date, end date/no. of days, interval)
Option 1 – Fetch current prices
Step 1 – Get the current market price
- Select the cell where the current price is to be displayed
- Type the formula using cell references:
- =GOOGLEFINANCE(Symbol)
- Press Enter
Step 2 – Get the opening price
- Select the cell where the open price is to be displayed
- Type the formula using cell references:
- =GOOGLEFINANCE(Symbol,”open”)
- Press Enter
Step 3 – Get yesterday’s closing price
- Select the cell where the price is to be displayed
- Type the formula using cell references:
- =GOOGLEFINANCE(Symbol,”closeyest”)
- Press Enter
Step 4 – Get other stock prices
- Enter the data for the other stocks
- Select the formulas
- Using the fill handle from the first cell, drag the formula to the remaining cells
OR
- Select the cell with the formula and press Ctrl+C or choose Copy from the context menu (right-click)
- Select the rest of the cells in the column and press Ctrl+V or choose Paste from the context menu (right-click)
Option 2 – Fetch historical data
Step 1 – Create the formula
- Select the cell where the result is to be displayed
- Type the formula using cell references:
- =GOOGLEFINANCE(Symbol,”close”, Start date, End date)
- Press Enter
Step 2 – Check the result
- The historical closing prices for INFY are displayed from 1st to 31st December 2022