Jump to content
Sign in to follow this  
litlmike

Table from IE.au3 to .xls

Recommended Posts

litlmike

How do I transfer data from a Table on a webpage, do an Excel file, using AutoIt?

I have a hard time understanding arrays, and tables written in HTML. With the help of others in the forum, I can read the info in a table to a GUI. But now, I need the info in Excel. I cannot give out the website for security reasons, but it is similar to the table you will see at this link:

http://www.footballoutsiders.com/stats/te.php

The table has 6 colums and can have 0-20 rows. After navigating to the page, I know I need to _IETableGetCollection, but what after that? Do I write it to an array, or what?

Thanks in advance, all help is appreciate.

Share this post


Link to post
Share on other sites
big_daddy

How do I transfer data from a Table on a webpage, do an Excel file, using AutoIt?

I have a hard time understanding arrays, and tables written in HTML. With the help of others in the forum, I can read the info in a table to a GUI. But now, I need the info in Excel. I cannot give out the website for security reasons, but it is similar to the table you will see at this link:

http://www.footballoutsiders.com/stats/te.php

The table has 6 colums and can have 0-20 rows. After navigating to the page, I know I need to _IETableGetCollection, but what after that? Do I write it to an array, or what?

Thanks in advance, all help is appreciate.

This should get you started:

#include <ExcelCOM.au3>
#include <IE.au3>

; Create a hidden browser window, and navigate to a page
$oIE = _IECreate ("http://www.footballoutsiders.com/stats/te.php")

; Get a reference to the third table on the webpage
$oTable = _IETableGetCollection ($oIE, 2)

; Read the table cells into a 2-D array
$XLArray = _IETableWriteToArray ($oTable)

; Close the browser window
_IEQuit ($oIE)

$sFilePath = @ScriptDir & "\temp.xls"

; Create a blank excel file
_XLCreateBlank ($sFilePath)

; Write the array to the excel file
_XLArrayWrite ($XLArray, $sFilePath, 1, 1, 1, 1)

Sleep(3000)

MsgBox(0, "", "The excel file will now close.")

; Close the excel file
_XLExit ($sFilePath)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.