Going Stellar

Home/Google Sheets reference

Google Sheets function · Google-only

GOOGLEFINANCE in Google Sheets: syntax and examples

GOOGLEFINANCE pulls market data for a ticker: the current price, the company name, or daily history between two dates. Currency pairs such as CURRENCY:USDEUR return exchange rates. The data is delayed and changes between recalculations.

Syntax

GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])

Arguments

ArgumentTypeRequiredWhat it does
tickertextyesThe exchange and symbol, such as "NASDAQ:GOOG", or a currency pair such as "CURRENCY:USDEUR".
attributetextnoWhat to fetch, such as "price", "name", "high" or "close". Default is "price".
start_datedatenoFor history: the first day. Using it switches the result to a table of dates.
end_date|num_daysdatenoThe last day, or a number of days after start_date.
intervaltextno"DAILY" or "WEEKLY", or 1 or 7. Default is daily.

Examples

The examples use this table, starting in A1:

TickerPair
NASDAQ:GOOGCURRENCY:USDEUR
=GOOGLEFINANCE(A2, "price")

Result: 272.44

Current price of a stock, in the currency of its exchange.

Run in a Google Sheet (English US locale) on . The result changes over time; this is the value on the run date.

=GOOGLEFINANCE(A2, "name")

Result: Alphabet Inc Class C

The company name for a symbol.

Run in a Google Sheet (English US locale) on . The result changes over time; this is the value on the run date.

=GOOGLEFINANCE(B2)

Result: 0.9132

A currency pair returns the exchange rate.

Run in a Google Sheet (English US locale) on . The result changes over time; this is the value on the run date.

=INDEX(GOOGLEFINANCE(A2, "close", DATE(2024, 1, 2)), 2, 2)

Result: 139.56

Historical close on a fixed day. The raw result has a header row, so INDEX picks the value.

Run in a Google Sheet (English US locale) on . The result changes over time; this is the value on the run date.

=INDEX(GOOGLEFINANCE(A2, "close", DATE(2024, 1, 2), DATE(2024, 1, 31)), 0, 2)

Result:

Close
139.56
140.36
138.04
137.39
140.53
142.56
143.8
143.67
144.24
144.08
142.89

All closing prices in January 2024, as one column with its header.

Run in a Google Sheet (English US locale) on . The result changes over time; this is the value on the run date.

Common errors

  • With start_date the result is a table with a header row, not one value. Use INDEX to take a single cell from it.
  • Attributes that exist only for the current quote, such as name, return #N/A when a date is given. Historical attributes are open, close, high, low and volume. With price and a start_date the result is a table of dates and closing prices.
  • An unknown symbol returns #N/A. The prefix in NASDAQ:GOOG names the exchange and fixes which listing is used.
  • Quotes are delayed by up to about 20 minutes and the value changes on every recalculation. Do not use it for exact records.

Compared with Excel

GOOGLEFINANCE exists only in Google Sheets. Excel uses the Stocks data type for similar data.

Questions and answers

Why does GOOGLEFINANCE return two rows?

Any call with a date range returns a header row first, then one row per day. Wrap it in INDEX, or use QUERY, to read only the values.

Sources

  1. GOOGLEFINANCE (Docs Editors Help)

Markdown version · All functions