How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (2024)

by Hady ElHady | Mar 13, 2024

There are multiple websites that offer interesting financial data, but it’s not always easy to get the data into Google Sheets. Google Finance and Yahoo Finance are among the most popular site for up-to-date financial data, but Yahoo Finance has data that Google Finance doesn’t. Google Finance data can be imported using the GOOGLEFINANCE formula, but how do you get Yahoo Finance data into Sheets?

In this article, you will learn how to import data from Yahoo Finance into Google Sheets using the IMPORTXML formula. You will learn how to get the base URL and the XPaths for the elements you want to import so that you can set up a template in Google Sheets. Once you’ve set it up, you only have to change the ticker symbol to get info on other stocks, currencies, etc.

How to Import Yahoo Finance Data into Google Sheets?

There are various methods that can be used to import data from Yahoo Finance. If you’re familiar with modern Javascript and Google Apps Script, you can write a custom function to import the data you need. However, if you’re not comfortable working with code, there are other ways to do this.

Google Sheets has a variety of import functions, depending on the source of the data. In this case, even though Yahoo Finance is a website, IMPORTXML is more appropriate than IMPORTHTML. Yahoo Finance pages have a fixed structure: each page has the same elements – price, closing date, volume, market cap, and many, many more. This means you can choose one specific page as an example and use it to create a template.

How to Import Yahoo Finance Data with IMPORTXML?

Since I will be using IMPORTXML, there are two parameters I need to set up my template: a URL, and the XPaths for the different elements we want to import. To learn more about the formula, check out this article on How to Use IMPORTXML in Google Sheets.

The formula you will need to use is:

=IMPORTXML(url, xpath_query)

Fortunately, Yahoo Finance pages are identically structured. This means you can create a template based on a sample page by getting the XPaths of specific elements. Then, all you need to do is change the ticker to get data from different sources. For this example, I will be using Google Chrome, as the Inspect feature makes it very easy to copy the XPaths.

Step 1: Get URL

In order to find the base URL, we first need to look at an example. Below, I will be using the Amazon.com, Inc. (AMZN) webpage in Yahoo Finance.

1. Copy the URL from your browser’s address bar.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (1)

How To Import Yahoo Finance Data Into Google Sheets – Copy URL

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (2)

How To Import Yahoo Finance Data Into Google Sheets – Paste URL

3. Copy the URL without the ticker symbol and paste it into a new cell.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (3)

How To Import Yahoo Finance Data Into Google Sheets – Base URL

How To Import Yahoo Finance Data Into Google Sheets

You want to analyze Yahoo Finance data in Google Sheets but are still using copy-paste? Here’s how to import Yahoo Finance data into Google Sheets instead.

READ MORE →

Step 2: Get XPaths

Once you find the base URL, you need to find the XPaths for the elements you want to import. I will be using ‘price’, ‘volume’, ‘market cap’, and ‘earnings date’, but you can choose whatever elements you want.

1. Add the element labels to your spreadsheet to keep track of which XPath belongs to which element.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (5)

How To Import Yahoo Finance Data Into Google Sheets – XPath Labels

2. Go back to the webpage and select the price. Right-click to get the menu and click “Inspect”.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (6)

How To Import Yahoo Finance Data Into Google Sheets – Inspect Element

3. In the Inspect console, you can see the code corresponding to the selection. In this case, the code is highlighted correctly, as you can see below.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (7)

How To Import Yahoo Finance Data Into Google Sheets – Element Selection

4. Right-click on the selected code, then Copy > Copy full XPath.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (8)

How To Import Yahoo Finance Data Into Google Sheets – Copy Full XPath

5. Paste the XPath into the corresponding cell on Sheets. In this case, it’s the one for ‘price’, so I’ll paste it next to its label.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (9)

How To Import Yahoo Finance Data Into Google Sheets – Paste XPath

6. To get the XPath for ‘volume’, go back to the webpage and find the data. Select the ‘volume’ value, right-click and select “Inspect”.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (10)

How To Import Yahoo Finance Data Into Google Sheets – Inspect Volume Element

7. Just like for the ‘price’, copy the full XPath.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (11)

How To Import Yahoo Finance Data Into Google Sheets – Copy Full XPath

8. Paste the ‘volume’ XPath to the corresponding cell in Sheets.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (12)

How To Import Yahoo Finance Data Into Google Sheets – Paste Volume XPath

9. Continue with the process until you have all the XPaths for the elements you want to import.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (13)

How To Import Yahoo Finance Data Into Google Sheets – Get Additional XPaths

How to Use IMPORTXML in Google Sheets (Examples)

Google offers multiple options to import data from external sources. Here’s how to use IMPORTXML to import structured data from a URL into Google Sheets.

READ MORE →

Step 3: Set Up Template

Now that you have the base URL and the XPaths, you can set up a template in Sheets.

1. Set up your table, including fields for the ‘ticker’ and ‘tickerURL’. I’ll use ‘AMZN’ as the placeholder while I set up the template.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (15)

How To Import Yahoo Finance Data Into Google Sheets – Set Up Template

2. For the ‘tickerURL’, concatenate the ‘baseURL’ and the ‘ticker’, using the “&” symbol as shown below.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (16)

How To Import Yahoo Finance Data Into Google Sheets – Create Ticker URL

3. As you can see, the ‘tickerURL’ includes the ticker symbol at the end, just as it should.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (17)

How To Import Yahoo Finance Data Into Google Sheets – Ticker URL

4. Next to the ‘price’ label, type in the IMPORTXML formula.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (18)

How To Import Yahoo Finance Data Into Google Sheets – Add IMPORTXML Formula

5. Select the ‘tickerURL’ as the URL parameter in the formula, using absolute referencing ($), so you can copy the formula down. Select the XPath corresponding to price as the second parameter. Close the parenthesis and press Enter on your keyboard.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (19)

How To Import Yahoo Finance Data Into Google Sheets – Add Cell References

6. Drag the formula down to the other elements to retrieve the rest. As you can see below, the data has been successfully imported.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (20)

How To Import Yahoo Finance Data Into Google Sheets – Drag Formula Down

Step 4: Import Data

By simply changing the ‘ticker’, you can import data from different companies. For example, let’s try ‘MSFT’.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (21)

How To Import Yahoo Finance Data Into Google Sheets – Change Ticker Symbol

There are some limitations to IMPORTXML, of course, such as the number of times you can use the IMPORTXML formula in your Google Sheets file. Theoretically, the limit is 50, but you may experience problems before getting to that number. However, the previous example only uses the formula 4 times since it retrieves 4 data elements.

You can easily get data for multiple companies at the same time by adding more columns for each ticker symbol. You can also add/remove elements to ensure you only import what you need.

Conclusion

Importing data from Yahoo Finance to Google Sheets is easy using IMPORTXML. You can get the XPaths quickly using Chrome’s Inspect tool and save them in your Google Sheets file to be reused. Once the template is set up, all you need is to add the ticker symbol you’re interested in, and you’ll have the data available in your Google Sheets file.

You now know how to use Google Sheet’s IMPORTXML to retrieve data from Yahoo Finance pages. You know how to find the base URL, as well as how to use Google Chrome’s Inspect to get the XPaths for all the elements you want to import.

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog (2024)

FAQs

How To Import Yahoo Finance Data Into Google Sheets | Layer Blog? ›

Open a new or existing Google Sheets spreadsheet. In a cell, enter one of the import formulas followed by the Yahoo Finance URL in parentheses. For example, to import the current stock price for Apple (AAPL), use the formula: =IMPORTXML("https://finance.yahoo.com/quote/AAPL","//fin-streamer[@data-symbol='AAPL']")

Does Yahoo Finance work with Google Sheets? ›

Integrating Yahoo Finance data into Google Sheets is a powerful way to streamline your financial analysis and decision-making process. In this step-by-step guide, we'll walk you through the process of setting up a custom function in Google Apps Script to import Yahoo Finance data directly into your Google Sheets.

How do I import financial data into Google Sheets? ›

Access Google Finance data in Sheets
  1. Create a new sheet in Google Sheets 'sheets. ...
  2. To access the finance data, click on a cell and start your query by entering:=GOOGLEFINANCE(“The full query requires the following:=GOOGLEFINANCE(ticker, [attribute], [start_date], [end_date|num_days], [interval])

How to pull data from Yahoo Finance? ›

Export and import portfolio data in Yahoo Finance
  1. Sign in to Yahoo Finance.
  2. Click My Portfolio.
  3. Click the portfolio name of the list you want to export.
  4. Click Export.
  5. Open the Downloads folder on your computer to find the exported file named "quotes. csv."

What is the alternative to GOOGLEFINANCE in Google Sheets? ›

=YHFINANCE is a spreadsheet formula that allows you to pull the Finance data directly into a Google Sheets spreadsheet. =YHFINANCE formula works in a similar way to =GOOGLEFINANCE for fetching current or historical securities information.

How do I pull data from Yahoo Finance to Google Sheets? ›

To use this custom function in your Google Sheets, simply enter =yahooF("TICKER") in a cell, replacing "TICKER" with the desired stock symbol. The function will retrieve the current price and display it in the cell. For more advanced data tasks, check out how to scrape data from websites using no-code tools.

What format is import for Yahoo Finance? ›

Import data with a CSV file

The simplest way to import data from Yahoo Finance to Google Sheets is with a CSV file.

How do I automatically import data into Google Sheets? ›

Import Live Data to Google Sheets: Top Methods and Tools
  1. Step 1 – Install Coefficient.
  2. Step 2 – Import Live Data.
  3. Filter, sort, and limit rows to import only the data that you want into Google Sheets.
  4. Step 3 – Schedule Automatic Data Refreshes.
Jun 16, 2023

How do I pull stock data into Google Sheets? ›

Setting Up Your Spreadsheet for Stock Data
  1. Open a new Google Sheets spreadsheet.
  2. In cell A1, enter the header "Ticker Symbol"
  3. In the cells below A1, list the ticker symbols for the stocks you want to track (e.g., "NASDAQ:GOOG", "NYSE:AAPL")
  4. In cell B1, enter the header "Attribute" (e.g., "Price", "Volume", "High", "Low")

Can you link GOOGLEFINANCE to Google Sheets? ›

Google Sheets offers a powerful built-in function called GOOGLEFINANCE that allows you to easily fetch real-time or historical stock prices, market indices, and currency exchange rates, directly into your spreadsheet.

Can I scrape data from Yahoo Finance? ›

Does Yahoo Finance allow scraping? Yes, you can scrape yahoo finance. With any web scraping tool, you can choose any stocks from yahoo finance and extract the information you need.

How do I copy from Yahoo Finance? ›

Go to Yahoo Finance. Look up the quote page for a stock whose chart you want to share. In the upper right, click Share. Click Copy or one of the social media icons.

What is the alternative to Yahoo Finance data? ›

Alternatives to Yahoo Finance API
  • EODHD APIs (EOD Historical Data)
  • Finnhub.
  • Twelve Data.
  • Alpha Vantage.
  • Finage.

Does GOOGLEFINANCE still work? ›

Google still offers financial data for use Google Sheets spreadsheets through the use of the GOOGLEFINANCE formula, but the API is no longer available to users. If you are interested in using Google's financial data, learning about the GOOGLEFINANCE formula is the best way to access this data.

Is there anything better than Google Sheets? ›

Microsoft Excel has more data visualization options, and its formulas are more customizable with features like pivot tables and array formulas. If your business requires more functionality for calculations and analysis, then Excel is the better option compared to Google Sheets.

Is Yahoo Finance API free? ›

Yahoo Finance API offers both free and paid plans. The free version provides limited access to financial data and is suitable for casual users or small projects. However, if you need more comprehensive data or higher usage limits, you'll have to opt for a paid tier.

Can you use Google Sheets with a Yahoo account? ›

You can use the same way to access Google Sheets, it will be attached after choosing Google Sheets; However, you can't preview the Google Sheets information, only attach or remove it in Yahoo Email.

Is GOOGLEFINANCE or Yahoo Finance more accurate? ›

However, Yahoo Finance stands out with its detailed analyses and expert opinions, making it a better choice for users seeking in-depth insights. Google Finance provides quick access to headlines and articles, which may be adequate for users who need a general overview of financial news.

What is Google Sheets compatible with? ›

Google Sheets is available as a web application; a mobile app for: Android, iOS, and as a desktop application on Google's ChromeOS. The app is compatible with Microsoft Excel file formats.

What database does Yahoo Finance use? ›

The RTD database contains preconfigured tables for getting a lot of fundamentals data from Yahoo!

Top Articles
Ready to launch: US stock markets are poised for a strong 2024 | White & Case LLP
The Dow Will Probably Hit 50,000 by 2027
Washu Parking
Algebra Calculator Mathway
Songkick Detroit
Pwc Transparency Report
Gwdonate Org
4156303136
Nj State Police Private Detective Unit
Grasons Estate Sales Tucson
2016 Hyundai Sonata Refrigerant Capacity
Billionaire Ken Griffin Doesn’t Like His Portrayal In GameStop Movie ‘Dumb Money,’ So He’s Throwing A Tantrum: Report
Xomissmandi
Kiddle Encyclopedia
Craigslist Portland Oregon Motorcycles
Zack Fairhurst Snapchat
Strange World Showtimes Near Roxy Stadium 14
Glenda Mitchell Law Firm: Law Firm Profile
18889183540
Menus - Sea Level Oyster Bar - NBPT
Обзор Joxi: Что это такое? Отзывы, аналоги, сайт и инструкции | APS
Cb2 South Coast Plaza
The Banshees Of Inisherin Showtimes Near Broadway Metro
CVS Health’s MinuteClinic Introduces New Virtual Care Offering
Cable Cove Whale Watching
Shelby Star Jail Log
Skidware Project Mugetsu
Ullu Coupon Code
The Goonies Showtimes Near Marcus Rosemount Cinema
30+ useful Dutch apps for new expats in the Netherlands
Pay Stub Portal
Chadrad Swap Shop
Basil Martusevich
Texas Baseball Officially Releases 2023 Schedule
R Nba Fantasy
Rage Of Harrogath Bugged
Oriellys Tooele
Final Jeopardy July 25 2023
Fapello.clm
Noaa Marine Weather Forecast By Zone
Craigslist - Pets for Sale or Adoption in Hawley, PA
How to Quickly Detect GI Stasis in Rabbits (and what to do about it) | The Bunny Lady
The Conners Season 5 Wiki
Alpha Labs Male Enhancement – Complete Reviews And Guide
844 386 9815
Top 1,000 Girl Names for Your Baby Girl in 2024 | Pampers
10 Types of Funeral Services, Ceremonies, and Events » US Urns Online
Iman Fashion Clearance
R/Gnv
Mail2World Sign Up
Peugeot-dealer Hedin Automotive: alles onder één dak | Hedin
Comenity/Banter
Latest Posts
Article information

Author: Stevie Stamm

Last Updated:

Views: 6313

Rating: 5 / 5 (80 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Stevie Stamm

Birthday: 1996-06-22

Address: Apt. 419 4200 Sipes Estate, East Delmerview, WY 05617

Phone: +342332224300

Job: Future Advertising Analyst

Hobby: Leather crafting, Puzzles, Leather crafting, scrapbook, Urban exploration, Cabaret, Skateboarding

Introduction: My name is Stevie Stamm, I am a colorful, sparkling, splendid, vast, open, hilarious, tender person who loves writing and wants to share my knowledge and understanding with you.