Jump to content

Table from IE.au3 to .xls


Recommended Posts

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.

Link to comment
Share on other sites

  • Moderators

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)
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...