Yahoo Finance provides financial news, data and commentary including stock quotes, press releases, financial reports, and original content. We can use the Yahoo Finance API to import data from Yahoo Finance into Google Sheets. In this tutorial, we’ll show you how to connect the Yahoo Finance REST API to Google Sheets in 5 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
IF YOU HAVE ANY TROUBLE WITH THE YAHOO FINANCE API USED IN THIS TUTORIAL, YOU CAN FIND MORE YAHOO FINANCE APIs HERE: - https://rapidapi.com/search/yahoo%20finance - https://www.google.com/search?q=yahoo+finance+api
In this tutorial we are using the Yahoo Finance API available at RapidAPI.com.
After creating a Rapid API developer account or logging in to your account (https://rapidapi.com/hub), go to the Yahoo Finance API pricing page (https://rapidapi.com/apidojo/api/yahoo-finance1/pricing) and select a pricing plan. In this tutorial we used the Basic plan.
After signing up for a plan, navigate to the Endpoints tab where you will see X-RapidAPI-Key and X-RapidAPI-Host:
Copy these values to a safe location because you’ll need them in the next steps.
In this section, we’ll show you how to browse the available endpoints to find an API URL that retrieves the specific data you need from Yahoo Finance. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the Yahoo Finance API documentation page: https://rapidapi.com/apidojo/api/yahoo-finance1/
The menu on the left contains the Yahoo Finance API’s endpoints:
In this case, we will describe the GET conversation/list endpoint which lists conversations relating to a symbol:
https://apidojo-yahoo-finance-v1.p.rapidapi.com/conversations/list?symbol=AAPL&messageBoardId=finmb_24937®ion=US&userActivity=true&sortBy=createdAt&off=0
In the Code Snippets section of the page, choose Shell => cURL to display the cURL command for the endpoint. This will help us make the request.
The documentation for this endpoint contains its HTTP method and URL path, a short description of the endpoint’s purpose, the header parameters, the required and optional parameters and the cURL command:
All API calls to the Yahoo Finance API should be made using the https://apidojo-yahoo-finance-v1.p.rapidapi.com/ base domain. All endpoints and parameters would be appended to this base domain.
The GET news/v2/get-details endpoint, which read the specific news in details.
Method: GET API URL Path: https://yh-finance.p.rapidapi.com/news/v2/get-details?uuid={uuid_value}®ion=US Headers: Header 1 Key: X-RapidAPI-Host Header 1 Value: yh-finance.p.rapidapi.com Header 2 Key: X-RapidAPI-Key Header 2 Value: your_API_Key
Replace your_API_Key with the key you previously obtained.
The GET screeners/get-filters endpoint, which gets optional filters for later use in …/screeners/list endpoint.
Method: GET API URL Path: https://yh-finance.p.rapidapi.com/screeners/get-filters?region=US"eType=mutualfund Headers: Header 1 Key: X-RapidAPI-Host Header 1 Value: yh-finance.p.rapidapi.com Header 2 Key: X-RapidAPI-Key Header 2 Value: your_API_Key
Replace your_API_Key with the key you previously obtained.
Okay, we’re in the home stretch. Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the Import tab. With the Import Tab open, enter these details into the add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) as required by your Yahoo Finance API endpoint. For this example, we are using the GET method.
API URL: In Step 3, I explained how you can find the Yahoo Finance API endpoint that you need. Now copy the complete API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.
For this example, we are using the GET auto-complete endpoint, that gets auto complete suggestions by term or phrase. The corresponding URL for this endpoint is:
https://apidojo-yahoo-finance-v1.p.rapidapi.com/auto-complete?q=tesla®ion=US
If you use this same URL, don’t forget to replace the q and region parameter values (the bolded values) with your own if you want.
In the Headers of the Apipheny add-on section, add two rows with the following keys and values:
Header 1 Key X-RapidAPI-Host Value apidojo-yahoo-finance-v1.p.rapidapi.com Header 2 Key X-RapidAPI-Key Value your_API_key
Replace your_API_Key with the key you previously obtained in Step 2, like so:
The last step is to click the Run button at the bottom of the Apipheny add-on and then your Yahoo Finance data will be imported into your Google Sheet.
After making a successful request to the Yahoo Finance API, try querying a different Yahoo Finance API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Related article: how to get technical analysis indicator data into Google Sheets
Crypto API tutorials and more:
Sponsored by Zink Virtual Tip Jar & Rewording.io Paraphrasing Tool
Accept donations on Twitch | Accept donations on Discord | Accept donations on YouTube | Accept donations on Telegram | Accept donations on Twitter | Accept donations on TikTok | Accept donations on Instagram | Accept donations on LinkedIn | Accept donations on Facebook | Accept donations on your Website