Small

IE to Excel

5 posts in this topic

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

Share this post


Link to post
Share on other sites



P.S. I'm sorry for my bad english. I'm dutch so there are some dutch words/sentences in there.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

_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 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

@water I found my solution. I used _excel_rangewrite like you said and it works perfect. thank you so much

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

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