September 19, 2024
How to get Yahoo Finance Data in Google Sheets!
 #Finance

How to get Yahoo Finance Data in Google Sheets! #Finance


in this CashNews.co we are going to be going over how to pull yahoo Finance data into google sheets and we can see here yahoo

href="https://cashnews.co/finance" style="font-weight: bold; color: #1a73e8; text-decoration: none;">Finance provides a lot of useful data that would be really nice to have into our spreadsheets so we’re going to go over how to pull things like the price which we can see listed

here the earnings date the x dividend date and if we scroll down even farther we are going to pull things in like you can see we have a full description of microsoft right here which we are going to pull into our spreadsheet and if we jump back over to our spreadsheet this is what our finished

product is going to look like this is just an example of what you can do and you can see here i have apple stock ticker listed here but by the time we’re finished you can put in whatever stock ticker you want and hit enter and you can see all this data is going to be pulled into our

spreadsheet from yahoo Finance so let’s go ahead and jump into our tutorial okay so you can see i already have my spreadsheet formatted where it is ready to pull in

yahoo Finance data and we want to pull things from yahoo none;">Finance like the price of the stock the earnings date the x dividend date we want to pull its industry and we also want a complete description of the company so let’s go ahead and jump over to yahoo color: #1a73e8; text-decoration: none;">Finance and for the sake of this tutorial we are going to be looking at microsoft and if you’ve looked at yahoo none;">Finance before then you’re familiar with the setup of this page we can see here they have the stock price listed they have their earnings date here they have their ex dividend date here and if we scroll down farther down this page we’ll be able to see a complete

description of microsoft let’s just go ahead and jump back over to our spreadsheet and if you’ve watched my web scraping CashNews.co on google sheets before then you know how to use the import html command that’s a really useful CashNews.co i suggest you watch it but for pulling

data from yahoo Finance we are actually going to be using a function called import xml you can see it listed right here and essentially what it does is it imports data from

structured data online and so we’re gonna go ahead and use this formula here and open up a parentheses and in order to use this formula the very first thing we’re gonna need to do is we’re going to jump back over to yahoo

style="font-weight: bold; color: #1a73e8; text-decoration: none;">Finance and what we’re going to do is we’re going to copy the url of this page into our spreadsheet and i know you guys can’t see me doing it but i’m up here at the top i’m copying the url

and i’m going back over to our spreadsheet now and what i’m going to do is i’m just going to add quotations and i’m going to paste the url so you can see it right here and i’m just going to close this off with quotations so that’s part one of pulling this data

into google sheets there’s only one more part all we’re going to do now is we’re going to add a comma and add quotations again and now we need to actually pull the price into google sheets so what we’re going to do is we’re going to jump back over to yahoo

href="https://cashnews.co/finance" style="font-weight: bold; color: #1a73e8; text-decoration: none;">Finance and again here is the price that we want to pull and this is where things they don’t necessarily get tricky but it is a little bit more advanced so what we’re going

to do is i’m going to double click or double tap here depending on if your mac and i’m going to come here and click on inspect and what’s going to happen when you click on inspect you’re going to have this show up on the right side of your screen and essentially it takes a

second to load so don’t fret if it takes just a moment but we’re going to have all this code show up on our right and you can see as i hover my mouse over these different codes different things over here are being highlighted so if i scroll down a little bit you can see the day’s

gain and percent gain is being highlighted but if we scroll back up we can see if i have my mouse listed right here it is highlighting the price of microsoft and that is what we’re going to need to pull into our spreadsheet so what we’re going to do is i’m going to double click on

this code right here if we come down here to copy you’re going to see we’re going to have a list of options i’m going to click on copy full xpath and once i’ve done that we’re going to jump back over to our spreadsheet and we’re going to paste this into our

formula we’ll close it off with quotations and close it off with a parenthesis so you can see what we did we used the import xml function we then added the url and then we pasted in the xpath like i just showed you and this is all we need in order to pull things into google sheets so when i

hit enter if everything goes as planned you can see we now have microsoft stock price listed in google sheets so what we’re going to do is i’m going to go ahead and go forward we’re going to pull things like our earnings date and x dividend date into google sheets using the exact

same method so let’s go ahead and we’ll copy the first part of this formula since that’s going to stay exactly the same so i’m just going to copy this we’ll put this here let’s go ahead and fix that there we go okay so you can see all i did was copy the first

part of this formula now we need a new xpath in order to pull in the earnings date so what we’re going to do is we’re going to jump back over to yahoo Finance and

if we scroll down let’s see the earnings date is listed right here so what i’m going to do is i’m going to double click on this we’ll click on inspect and you can see right here that april 29th is what i want to pull into my spreadsheet so i’m going to click double

click this we’ll come down here to copy we’ll copy the full xpath let’s jump back over to our spreadsheet and we’ll paste this in we’ll close off this quotations close it off with the parentheses and here’s our formula for earnings date i’ll push enter and

you can see we now have our earnings date in google sheets go ahead and center this text as well and so now i want to pull my x dividend date into google sheets so again we’re going to do this almost the exact same thing i’m going to go ahead and copy the first part of this formula

since it’s going to stay exactly the same and i’ll go ahead and paste that here and so if we jump back over to yahoo Finance we can see our ex dividend date is

listed right let’s go ahead and scroll back up it’s listed right here so again i’m going to double click on this we’re going to click on inspect and this will pull up it takes just a moment usually let’s scroll back down so we can see what we’re highlighting and

right here this is the code that we need to copy the xpath for so i’ll double click on this we’ll come down here to copy we’ll copy the full xpath jump back over to our spreadsheet and we will paste this into google sheets once again we’ll close it off with a parentheses be

sure to add quotations if you’re having trouble make check and make sure that your quotations are there for the url and the xpath let’s go ahead and hit enter and now we have our x dividend date in google sheets as well all we need left to do is import our industry and the detailed

company description so let’s go ahead and just like we have been doing we’ll go ahead and copy the first part of this formula just for time’s sake and jump back over to yahoo none;">Finance and now i need to find where the industry is listed here and pulling industry into google sheets is something that the google Finance function

doesn’t have so this is actually a really useful method so let’s go ahead and scroll down and see if we can find where this is listed and okay so here we go right here you can see the sector and the industry is listed you can pull on whichever one you want i’m going to go ahead

and pull in the sector so i’m going to double click right here we’ll click on inspect and let’s see if it’ll show us which one we need to pull up and right here is what we want to pull into google sheets so i’ll double click we’ll go to copy we’ll copy the

full xpath we’ll we’ll add quotations and paste this into our spreadsheet close it off and hit enter and now we have our industry into google sheets i’ll go ahead and increase the font size just a tad and the last thing that i want to pull in is our detailed description of the

company so again i’m going to copy the first part of this formula since it’s going to stay exactly the same and i’ll paste this in here and now let’s go back over to yahoo text-decoration: none;">Finance and here’s our detailed company description you can see it’s pretty long so it’s pretty cool to be able to pull this into our spreadsheet so we can see exactly what the business model is for each stock that we look at so let’s go

ahead and double click we’ll click on inspect and if we highlight our cursor here we can see this entire thing is being highlighted so let’s go ahead and double click we’ll go to copy we’ll copy the full xpath and we’ll come back over to our spreadsheet we’ll

paste this in and hit enter and there we go you can now see we have the entire company description paste it into google sheets so let’s go ahead and center this text i’ll give it just a little color let’s go ahead and fix the formatting for this and this as well and so we have

just successfully web scraped all of microsoft’s data into google sheets now you’ll notice if i were to change the stock ticker here to apple nothing updated and that’s because we hard coded all of this data what we can do is we can make a simple change in order to automate this

entire web scraping process and so what we’ll do is we’ll come over here to the price and we’re currently looking at the price for microsoft and what we can do is we can remove this part of the url right here remove microsoft as well and we’ll come right here outside of the

quotations and what we can do is we can actually add on to this url let me go ahead and fix that i’m going to remove this okay there we go so you’re going to remove all the data up to where it lists microsoft stock ticker in the url and what we’re going to do is we’re going

to add to this url and in order to do this all we’re going to do is we’re going to add an and sign let’s see maybe it needs to be right here we’re gonna add an and sign and we’re gonna click right here and once i’ve done that i’m gonna hit enter and you can

see we have microsoft stock price listed right here still but now if i were to change this to apple stock ticker we can see our price was automatically adjusted based off of what is listed right here and so this will work for pretty much any stock so let’s say i want to look at verizon

i’ll hit enter and this will automatically update or if i want to look at bank of america and you can see just how effective this can be when looking at large amounts of data so let’s go ahead and do this for all of our formulas all we need to do is remove this data here we’ll add

quotations we’ll add an and sign and we want to add on whatever is listed here we’ll do the same thing here as well we’ll do the same thing for our industry and now we’re going to do the same thing for our description we’ll add our and sign we’ll come up here

click on our stock ticker and hit enter and so now we’ve done everything correctly this entire spreadsheet should be completely automated to pull data from yahoo none;">Finance depending on the stock ticker that we have listed right here so let’s go ahead and test it out we’ll list apple stock ticker and hit enter and you can see all this data was automatically pulled so there you have it guys that is how you pull yahoo

href="https://cashnews.co/finance" style="font-weight: bold; color: #1a73e8; text-decoration: none;">Finance data and put it into google sheets and i also showed you how to completely automate the process so if you enjoyed the CashNews.co be sure to like and subscribe to the channel i

appreciate you watching this CashNews.co i’ll see you next time thanks so much

Now that you’re fully informed, check out this insightful video on How to get Yahoo Finance Data in Google Sheets!.
With over 89382 views, this video offers valuable insights into Finance.

CashNews, your go-to portal for financial news and insights.

35 thoughts on “How to get Yahoo Finance Data in Google Sheets! #Finance

  1. Hello, do you know why it only works with stocks and not cryptocurrency? I do exactly the same with both and with cryptocurrency, I receive the message "resource at URL contents exceeded maximum size" . I only want to insert the actual value.

  2. AUGUST 2024 — For those who also get ERROR or N/A, this will be expected to happen because Yahoo Finance uses DYNAMIC CONTECT to update this values, and this formula only works with STATIC CONTENT. So this WON'T work. If anyone finds a way to do it please share it.

  3. It would be great if following these instructions worked, but it just leads to a lot of errors. No copy format worked. Oh well, it was a nice tease. I'm assuming this was done to get us to pay for tickerdata.

  4. This is incredible! I went a little further on this and used CONCATENATE in conjunction with the first part of the formula. I've now got a sheet that I simply need to add the ticker into one column and the other columns fill with the data I need 🙂

  5. i can get anything above the "Summary
    Chart
    Conversations
    Statistics
    Historical Data
    Profile
    Financials
    Analysis
    Options
    Holders
    Sustainability" tabs to work, but not the data in the tabs, help plz?

  6. Doesn't work anymore, it seems that Yahoo Finance website could be using any Java formating. There is an error now in Google Sheets "Imported content is empty" when you do what you are doing when taking the earnings date (You cant really do much anymore).

  7. I am using a MacBook and try to double click on the areas and all I get is the area highlighted I try and do "control" and click and get options but I do not see an "inspect" option. What am I doing wrong…. please help

  8. You were a lifesaver today. I found this video to be incredibly valuable when I encountered a significant roadblock. Thanks to this video, I successfully completed my client's project.

Leave a Reply

Your email address will not be published. Required fields are marked *