Jump to content

IE to Excel


Small
 Share

Recommended Posts

Hi I'm Daan but ppl call me Small,

I made a little script for my work to export data from IE to an array and pasting that into excel.

#include <IE.au3>
#include <Excel.au3>
#include <File.au3>
#include <Msgboxconstants.au3>
#include <array.au3>
#include <StringConstants.au3>

;Ga naar rgd-inspecties.nl/pages/home.aspx
;zoek het
;

Global $url = InputBox("URL", "Wat is de Link van de website?","","",200,150)
Global $condor = "ctl00_contentPage_gridInspectie_ctl00__"
Global $ID
Global $Colom
Global $e
Global $path = @DesktopDir & "/smartware/Standaard.xls"

Export()

Func Export()

Local $oIE = _IEAttach($url, "url")
Local $oTable = _IETableGetCollection($oIE,48)
Local $aTableData = _IETableWriteToArray($oTable)
Local $count = ubound($aTableData,2) -3


ConsoleWrite("Er zijn "&$count&" Elementen.")

#Region Loop
For $ID = 0 to $count

    Local $atable = _IEGetObjById($oIE,$condor&$ID)

    For $Colom = 2 to 11 step 1

        $td = _IETagNameGetCollection($atable,"td",$Colom)

        $removeWS = StringReplace($td.innerhtml,"<br>",";")
        $removebr = StringStripWS($removews,8)
        $removeall = StringReplace($removebr,"&nbsp;",";")
        Local $splittest4 = StringSplit($removeall,";",1)

;~      _ArrayDisplay($splittest4)

        Local $r = UBound($splittest4)-1
        For $e = 1 to $r
            FileWrite($path,$splittest4[$e]&@CRLF)
;~          MsgBox(64,"",$splittest4[$e])
        Next

    Next

Next
#EndRegion loop


EndFunc

I got it working so that is writes the data to seperate cells in excel. The problem is that it is vertical and it needs to be horizontal. Is there an easy way of doing this?

 

I saw on some other topics that they used _ExcelWriteCell but that isn't in the Excel.au3 anymore.

 

Thanks in advance for the help.

 

Regards,

Small

Link to comment
Share on other sites

_ExcelWriteCell has been renamed to _Excel_RangeWrite in the latest version ogf AutoIt.
What has changed can be found here and in the wiki.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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