How to Get Data from Yahoo Finance in Excel

Cody Schneider

Pulling live financial data from Yahoo Finance into your Excel spreadsheet is a fantastic way to build personal finance dashboards, track investments, or perform market analysis. You can bypass the tedious process of manually copy-pasting numbers and instead create dynamic reports that update automatically. This tutorial will walk you through a few different ways to import stock data from Yahoo Finance directly into Excel.

Easiest Method: Excel’s Built-In Stocks Data Type

If you're using Microsoft 365 or a recent version of Excel, the absolute simplest way to get data from Yahoo Finance is by using the built-in "Stocks" data type. This feature converts plain text, like a company name or ticker symbol, into a rich data object packed with real-time financial information.

Step-by-Step Guide to Using the Stocks Data Type:

  1. List Your Tickers: Start by typing a list of company names or ticker symbols into a single column. For example, you might list AAPL, MSFT, GOOG, and AMZN. It’s best to use the official ticker symbol to avoid ambiguity.

  2. Convert to 'Stocks': Select the cells containing your tickers. Navigate to the Data tab on the Ribbon. In the "Data Types" group, click on Stocks.

  3. Confirm the Data: Excel will connect to the web and attempt to match each ticker with its corresponding company. If successful, you'll see a small "stock building" icon appear next to each company name. If Excel is unsure about a match (e.g., for a common name), a question mark will appear, allowing you to select the correct entity from a sidebar.

  4. Add Data Columns: With your converted cells still selected, a small "Insert Data" icon will appear to the top right of the selection. Click this icon to open a dropdown menu of available data fields. You can select things like:

    • Price

    • Change (%)

    • 52 Week High/Low

    • P/E Ratio

    • Market Cap

    • Volume

    • And many more...

    When you select a field, Excel will automatically create a new column next to your tickers and populate it with the corresponding data for each company.

Working with Formulas

Another powerful aspect of the Stocks data type is its use in formulas. Once a cell (let's say A2) is converted to a stock, you can reference its data points directly. For example:

  • To get the current price of the stock in cell A2, you can use the formula:=A2.Price

  • To get the P/E ratio, you’d use:=A2.[P/E]

This method keeps your spreadsheet clean and allows you to build custom calculations without cluttering your view with dozens of extra columns.

Manually Refreshing Your Data

The data from the Stocks feature is live, but it doesn't stream constantly. To get the latest information, go to the Data tab and click Refresh All. You can also configure its refresh settings by right-clicking a cell with the stock data type and going to Data Type > Refresh Settings.

Pros: Incredibly easy, visually clean, and integrates perfectly with Excel formulas.Cons: Limited to the data fields provided by Microsoft's service. It may not include every obscure metric you can find on the Yahoo Finance website. Only available in newer Excel versions.

Classic Method: Using Power Query ("From Web")

For more control or to extract specific data tables directly from a Yahoo Finance webpage, the "From Web" feature in Power Query is your best bet. This has been a reliable way to import stock data into Excel for years and is perfect for grabbing things like summary statistics, analyst ratings, or historical data.

Step-by-Step Guide to Importing a Table:

  1. Find Your Yahoo Finance URL: Go to Yahoo Finance in your browser and navigate to the page for the stock you want to track (e.g., https://finance.yahoo.com/quote/TSLA for Tesla). Find a table you wish to import, for instance the summary table showing "Previous Close," "Open," "Volume," and "Market Cap." Copy this URL.

  2. Open the "From Web" Connector: In Excel, go to the Data tab. In the "Get & Transform Data" group, click From Web.

  3. Enter the URL: A dialog box will appear. Paste the Yahoo Finance URL you copied into the field and click OK.

  4. Select Your Data Table: The Navigator window will open, showing a preview of the webpage. On the left side, Excel will list all the HTML tables it detected on the page. Click through them until you find the one containing the data you want. For a stock's summary page, you'll likely see two main tables.

  5. Load or Transform the Data: You have two main options:

    • Load: This will directly import the selected table into a new worksheet as a formatted Excel Table. This is the quickest option if the data looks clean.

    • Transform Data: This opens the powerful Power Query Editor, which allows you to clean, reshape, and filter the data before it ever reaches your worksheet. For example, you could remove unnecessary columns or change text to numbers. Once you're done, click Close & Load.

Keeping Your Web Query Data Current

The imported data is now connected to the source URL. To update it, just go to the Data tab and click Refresh All. You can also right-click the table and select "Refresh." For fully automated stock data, click the "Queries & Connections" button on the Data tab, right-click your query in the sidebar, choose "Properties," and set a refresh interval, such as every 5 minutes.

Pros: Gives you access to virtually any data table on the Yahoo Finance site, offers advanced data cleaning options via Power Query, and works with a wider range of Excel versions.Cons: Can break if Yahoo's website structure changes. It requires a few more steps than the Stocks data type.

Advanced Method: Pulling Historical Data with Power Query

What if you want to analyze a stock’s performance over the past five years? Manually copying historical data is a recipe for frustration. Instead, you can use Power Query to create a reusable, dynamic query that fetches historical stock prices for any ticker you want.

Step-by-Step Guide for Historical Data:

  1. Create a Ticker Input Cell: In your main Excel sheet, pick a cell (for example, F1). Type a ticker symbol like MSFT into it. Now, we need to give this cell a name. Select the cell, then go to the Name Box (the little box to the left of the formula bar that usually shows the cell reference like 'F1') and typeStockTickerand press Enter. This creates a Named Range, which Power Query can use as a parameter.

  2. Construct the URL: The URL structure for historical data on Yahoo Finance is usually predictable. Start with a real URL from your browser’s "Historical Data" tab for any stock. For instance:https://finance.yahoo.com/quote/MSFT/history?p=MSFTWe will later make the MSFT part dynamic in Power Query.

  3. Start the 'From Web' Query: In Excel, go to Data > From Web, paste the sample Yahoo Finance URL for historical data, and click OK.

  4. Select and Transform: In the Navigator window, select the table containing the historical prices. It's usually the largest one. Click Transform Data to open the Power Query Editor.

  5. Make it Dynamic: Now for the magic. In the Power Query Editor, go to the Home tab and click Advanced Editor. This shows you the M code that Power Query wrote. Find the line that contains the URL. It will look something like this:Source = Web.Page(Web.Contents("https://finance.yahoo.com/quote/MSFT/history?p=MSFT"))You’re going to replace the hardcoded "MSFT" with a reference to the named range you created. Modify the code to look like this:

    This tells Power Query: "First, get the value from the 'StockTicker' named range in Excel. Then, build the URL using that value." Click Done.

  6. Clean and Load: You may want to do some final cleanup in the editor, like removing dividend rows (filter the "Close*" column to exclude rows with "Dividend" text) or ensuring the date and price columns have the correct data types. When you're happy, click Close & Load.

Now you have a table of historical data for MSFT. But the best part? If you go back to cell F1 and change "MSFT" to "AAPL" and then click Data > Refresh All, the entire table will instantly update with historical data for Apple. You've created a reusable tool for financial analysis.

Final Thoughts

Whether you need a quick price check or a detailed historical analysis, connecting Yahoo Finance to Excel transforms it into a powerful financial dashboard. The Stocks data type is perfect for simple tracking, while Power Query gives you the unlimited flexibility to grab virtually any data you want and automate the entire process.

Excel is an amazing tool for detailed, hands-on analysis, but managing data across platforms - from your website analytics to your ad campaigns to your CRM - often requires even more manual CSV exports and report building. At Graphed, we built an AI data analyst to eliminate that friction. Instead of wrestling with web queries for every data source, you can connect your apps in seconds and use natural language to create real-time dashboards (e.g., "Show me a chart of my Google Ads cost vs Shopify revenue since last month"). We handle all the connections and refreshes in the background, making it effortless to get answers from all your business data, all in one place. You can try Graphed for free.