Link Excel to Yahoo Finance

andreastasia95

New Member
Joined
Dec 18, 2019
Messages
18
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
Platform
  1. Windows
Hello everybody,
I'm trying to download financial data from yahoo finance: specifically I have all the tickers of the shares of the Italian market (circa 450 stocks) in an Excel file and I would like to extract some tables from the "key-statistics" section. I'm not very skilled with VBA and what I did was create a query that uses a variable input (the link, easily reconstructed), based on the youtube tutorial (
). This procedures works with the downloading from reuters.com, but the problem for using that site is that I should know the RICs (reuters id of a stock), with yahoo finance I have to know only the ticker and I know it.

The problem is that while writing the exact link, Excel cannot extract the tables, but doing single a single query for every ticker, it works. I think that the problem is related to the existance of a lot of tables in that yahoo finance page (for example look at NEXI (NEXI.MI) Misure di valutazione e statistiche finanziarie).

I'm going crazy, does anyone have any ideas?

Thank you!!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I am so sorry, the youtube video is wrong, here is the right one:


Sorry guys!
 
Upvote 0
did you try Power Query (Get&Transform) ?

navig.jpg
 
Upvote 0
did you try Power Query (Get&Transform) ?

View attachment 2293
Yes, I think... I followed all the step of the video tutorial posted.
-First I have to create a query selecting the table that i want
-Then I have to edit that query, giving a variable structure and the input of the query is the URL, so the query now is a connection only
-Then I have to create a query from table and with the powerquery editor i add a custom column that is equal to the function of the previous step giving as input a column of URLs (related to the key statistic)
- So what I should be a giant table with all the information for each ticker (with reuters was going on)

do you mean anything else with Power Query (Get&Transform)?
 
Upvote 0
This is the code of the query

--
(URL) as table =>

let
Origine = Web.Page(Web.Contents(URL)),
Data9 = Origine{9}[Data],
#"Modificato tipo" = Table.TransformColumnTypes(Data9,{{"Ricavi (ttm)", type text}, {"7,17B", type text}})
in
#"Modificato tipo"
--

I have updated only the first row and what is inside Web.Contents

Then when i add the custom column in the power query editor I call the query (that is a function) givin URL as input, and URL is a column of a table in excel, as the image:

1576678419512.png
 
Upvote 0
#"Modificato tipo" = Table.TransformColumnTypes(Data9,{{"Ricavi (ttm)", type text}, {"7,17B", type text}})
error.jpg

so maybe check your Modificato tipo

IMHO remove whole line Modificato tipo from function like this:
Code:
(URL) as table =>
let
    Origine = Web.Page(Web.Contents(URL)),
    Data9 = Origine{9}[Data]
in
    Data9
and try again

result.jpg
 
Last edited:
Upvote 0
It doesn't work... I think that it try to extract data from Yahoo Finance, but i see only #NA... the problem is that doing web queries mannually for each ticker it works... the 4AIM.MI doesn't have value because is a little company, but ABT.MI is bigger and have value but the query doesn't give values...
 
Upvote 0
Thank you for your help, that is amazing!!!! It is a kind of Bloomberg provider but free!

Really, thank you very much for solving my problem!
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,467
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top