Yahoo Finance Functions for Google Sheets™

Introduction
Since its inception, Yahoo Finance has been a cornerstone for investors and market enthusiasts. It offers price quotes, breaking news, and a wealth of financial data. The platform provides a comprehensive snapshot of the markets alongside curated business headlines. Thanks to its clean interface and diverse tools, it’s a favorite among casual investors.
Beyond the basics, Yahoo Finance offers watchlists for tracking multiple tickers, interactive charts for visualizing performance, and aggregated research reports for deeper analysis. Interestingly, Yahoo once provided an official API, but it was discontinued in 2017 due to misuse. Nevertheless, the financial community quickly adapted, discovering alternative ways to tap into Yahoo’s rich public data.
Building on these community efforts, we created a custom YAHOOFINANCE() function that brings Yahoo Finance data directly into Google Sheets. It’s designed to be a robust alternative to the native GOOGLEFINANCE() function, leveraging Yahoo’s rich public data sources to deliver real-time prices, historical data, dividends, and stock splits
Get Started
Because this script uses unofficial APIs, it cannot be listed on the Google Workspace Marketplace. Instead, you can get started in two simple steps: copy the template sheet (with the script included) and authorize it to run.
Click here to get the Google Sheet TemplateImportant: The first time you run the
YAHOOFINANCE()
function, Google will ask you to grant the necessary permissions for the script to run. This is a standard, one-time authorization required to activate the function.
Function Syntax
The function is designed to be flexible, changing its behavior based on the parameters you provide.
YAHOOFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])
Quick Examples
Here are a few common use cases to get you started immediately.
Fetch Real-Time Data
To get the current market price, just provide the ticker.
=YAHOOFINANCE("AAPL")

To get another real-time attribute, specify it in the second parameter.
=YAHOOFINANCE("GOOGL", "name")

Fetch Historical Data
To get historical data, add a start_date
. Use "ALL"
to get a full OHLCV table.
=YAHOOFINANCE("TSLA", "ALL", "1/1/2024", TODAY())

Fetch Dividends and Splits
Use the special attributes "dividends"
or "splits"
with a date range.
=YAHOOFINANCE("MSFT", "dividends", "1/1/2020", TODAY())

Fetch Data for Multiple Tickers
For any historical request, you can use a comma-separated list of tickers.
=YAHOOFINANCE("KO,PEP", "CLOSE", TODAY()-90,TODAY())

Key Features
Unified & Intelligent
It knows whether to fetch real-time or historical data based on the parameters you provide.
Powerful & Feature-Rich
It handles single tickers, multiple tickers, historical prices, dividends, and splits.
User-Friendly & Simple
It has a clean, intuitive syntax that mimics GOOGLEFINANCE, with a smart default for fetching the current price.
Robust
It’s built on reliable API endpoints and includes solid error handling.
Full Function Reference
For a detailed breakdown of every parameter and available attribute, please see the complete Function Reference page.
View Full Function Reference