How to import Yahoo Finance data into Google Sheets

Jason Hee
CodeX
Published in
3 min readMay 26, 2022

--

Photo by homajob on Unsplash

Google Sheets has been my spreadsheet app of choice for tracking my budget and the performance of the stocks in my portfolio. Google sheets include the GOOGLEFINANCE formula that enables you to track the prices of stocks in an automated way, without the need for manual data entry.

For instance, you can get the price of Apple’s stock like so: =GOOGLEFINANCE("AAPL")

Unfortunately, the GOOGLEFINANCE formula does not return valid data for some tickers. It appears that the underlying data set for the GOOGLEFINANCE formula is not a comprehensive one. The formula is missing data for tickers like ES3 (SPDR Straits Times Index ETF) and CPI:L (Capita PLC), to name a few.

Yahoo Finance contains a much more comprehensive data set for stock tickers. And we can use a Google Apps script to import data from Yahoo Finance into a Google sheet.

First, let’s create a new Google Apps script. In your Google sheet, navigate to Extensions -> App Scripts in the toolbar:

This should bring you to a code editor for Apps Scripts:

--

--