Jump to content

Pull Web Table


Recommended Posts

Here is my current code

#include <Array.au3>
#include <IE.au3>
#include <Excel.au3>

Global $Day = @MDAY, $Month = @Mon, $Year = @Year, $sFilePath1 = @ScriptDir & "\HistoricStockData.xlsx", $Page = "00", $StockSymbol = "GOOG"
If $Month = "1" Then $Month = "0" Or If $Month = "2" Then $Month = "1" Or If $Month = "3" Then $Month = "2" Or If $Month = "4" Then $Month = "3" Or If $Month = "5" Then $Month = "4" OrIf $Month = "6" Then $Month = "5" Or If $Month = "7" Then $Month = "6" Or If $Month = "8" Then $Month = "7" Or If $Month = "9" Then $Month = "8" Or If $Month = "10" Then $Month = "9" Or If $Month = "11" Then $Month = "10" Or If $Month = "12" Then $Month = "11"

$Url = "http://finance.yahoo.com/q/hp?s=" & $StockSymbol & "&a=03&b=12&c=1860&d=" & $Month & "&e=" & $Day &"&f=" & $Year & "&g=d&z=66&y=" & $Page
$oIE = _IECreate ($Url);Logout of any possible log in accounts
_IELoadWait ($oIE)
$oTable = _IETableGetCollection ($oIE, 15)
$aTableData = _IETableWriteToArray ($oTable)
_ArrayDisplay($aTableData)

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
_ExcelWriteSheetFromArray($oExcel, $aTableData, 1, 1, 0, 0) ;0-Base Array parameters

All works great pastes the data straight into excel.. But my only issue is how it pastes it..

Currently it dose them up right where a1 = date a2 = open b1 = the date c1 = the next date and so on

I would perfer to have this formated so a1 = date b1 = open c1 = high a2 = 1st date a3 = second date b2 = 1st open b3 = second open and so on

is there a easy way to do this cause all I can think of is some long string stuff

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...