How to grab tables off the web

  • Thread starter Thread starter AlekM
  • Start date Start date
A

AlekM

I know that with the web query in Excel you can download tables just b
clicking on the yellow arros by using the Import Web data tool
However, I was wondering is anybody knew what is the query that you ca
put in a cell that can download that data.

For example, what do I need (if I can) in cell A1 to download th
income statement for Phizer from http://finance.yahoo.com/q/ks?s=PFE

is this doable?

Thanks
 
doing file=>open and pasting in your URL did pretty well. You would have to
delete a lot of extraneous stuff.

With code, using a web query you can do

Sub GetPFE()
'URLAddress = "http://finance.yahoo.com/d/quotes.csv?s="
URLAddress = "http://finance.yahoo.com/q/ks?s="

mystringend = "PFE" '& "&f=snd1t1l1ohgpv&e=.csv"
myurl = URLAddress + mystringend
With ActiveSheet.QueryTables.Add(Connection:="URL;" & myurl, _
Destination:=Sheets("Data1").Range("b2"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top