Last Updated on September 22, 2023 by Mark Ursell
In this article and video, I show you how to download price data from Yahoo Finance into Excel.
Table of Contents
Yahoo Finance is the best source of free historical price data on the internet. If you regularly use Yahoo price data in Excel, this article will save you time and help you download the data quickly and easily.
Anyone who is interested in Market Analysis, Technical Indicators, and Backtesting will benefit from this article.
What is the Free Spreadsheet?
I have created a spreadsheet to automate the download process.
This spreadsheet uses VBA to automate the downloading process. Making it quicker and easier for you to get the data you need for your analysis.
How to Use the Spreadsheet
When you open the spreadsheet you will see options to select the market, date range and frequency (period).
You then click the button, and the data is imported in your spreadsheet.
The spreadsheet was designed in Excel for Windows but should also work in Excel for Mac.

Watch The Video
In this YouTube video, I demonstrate the formulas and how to use the spreadsheet.
Get the Free Spreadsheet
You can download the spreadsheet for free by signing up to my mailing list:
Excel Formulas
If you want to create your own spreadsheet you can see the formulas that I used to create it.
URL Information Needed to Download the Data
Sample URL
Every time you download data from Yahoo Finance it generates a URL that corresponds to your query.
The URL format looks like this:
https://query1.finance.yahoo.com/v7/finance/download/%5EGSPC?period1=1530489600&period2=1593561600&interval=1wk&events=history
Market Code
The market code is the information used by Yahoo to identify the stock, ETF or currency. These codes are not always the same as the codes you will find used elsewhere.
If you don’t know the code, you can get it by going to the Yahoo Finance page for the market you are

Date Range
You need to specify the date range of the price data.
The dates are expressed in UNIX format. The formula to calculate the Unix Code is:
=(Current Date-DATE(1970,1,1))*86400
Interval (Period)
Yahoo Finance Data is available for daily, weekly and monthly periods. In the URL it is 1d, 1wk and 1mo.
The Next Step: Backtest Your Strategy
“The goal of a successful trader is to make the best trades. Money is secondary.”
Dr Alexander Elder
Get More Winning Trades
If you are eager to take your trading strategies and market analysis to the next level, consider exploring Tradinformed Excel Backtest Models. These Excel-based models will help you design, optimize and track your trading strategies.
The 15-in-1 Package is our most powerful package. This will help you learn how to backtest trading strategies and make informed trading decisions while providing you with the tools you need to develop your own trading systems.
Excellent article. Is there a way to fetch data in Intraday timeframe?
Thank you Prateek, that is a good question. Yahoo Finance only offers daily, weekly and monthly historical data. So you can’t use this exact process to get intraday. If you have an online source of intraday data you can use the Excel data import function to get it directly into your spreadsheet. One suggestion is to try MT4, lots of brokers offer it, and you can download historical data directly from the platform.