Thread: Google finance
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Google finance

This is NOT very elegant, but it seems to do the job:
Sub Macro1()

With ActiveSheet.QueryTables.Add(Connection:= _

"URL;http://finance.google.com/finance/historical?histperiod=weekly&cid=10261&startdate=J an+1%2C+1990&+1990&enddate=Jan+28%C+2009&output=cs v" _
, Destination:=Range("A1"))

.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With

Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5,
1), Array(6, 1)), _
TrailingMinusNumbers:=True
End Sub

Regards,
Ryan---

--
RyGuy


"David" wrote:

Hi Group,

I am trying to import in CSV from Google Finance a stock price history. I am
able to do this from Yahoo, but am unable to do it from Google.

The ticker is DD, weekly, from Jan 1, 1990 to Today.

The web address is :
http://finance.google.com/finance/hi...=Jan+28%C+2009

Another problem that I may encounter is that the symbol name is not part of
the above. I is fairly easy to get what is on the screen into code, but I am
unable to get the whole table.

The link to the download is:
http://finance.google.com/finance/hi...9&output=cs v

It is the above I believe has to be coded? Anyone else try and do this? In
Yahoo, this type of address has included the ticker symbol, maybe that what
to "cid=10261" represents? This may make impossible.

Thanks for your imput,
David