Jump to content

Enter the data in excel file into a system


villy
 Share

Recommended Posts

Dear all,

I am new in AutoIT~ I would like to enter the data in excel file into a system user interface.

for example:

excel file's data:

name age

----------------------

ann 25

andy 30

when run on the script, the autoIt will enter the value "ann", "25" then save.

for second time, it take the value "andy", "30" and save again.

Any idea to do it?

Thanks~!!

Link to comment
Share on other sites

Dear all,

I am new in AutoIT~ I would like to enter the data in excel file into a system user interface.

for example:

excel file's data:

name age

----------------------

ann 25

andy 30

when run on the script, the autoIt will enter the value "ann", "25" then save.

for second time, it take the value "andy", "30" and save again.

Any idea to do it?

Thanks~!!

reading from excel, and working with the data in excel is very easy, as far as taking it somewhere else, 'system user interface' ? could you be more specific?

here's an example to grab the data and send it to a message box, assuming that you only have one workbook open, the active sheet has the data, and the first row is headers as it looks like above. you can use COM to control excel, and open worksheets etc without even displaying them, but i'm not entirely sure what you're looking for. if you offer more specifics, such as file name, worksheet name, what interface data is supposed to be sent to etc, i can give you more targetted assistance.

$myex = ObjGet("","excel.application")
If Not IsObj($myex) Then
    MsgBox(0,"Error","Failed to grab excel object")
    Exit
EndIf
$mywb = $myex.activeworkbook
$myws = $mywb.activesheet
$tmp = ""
$x = 2
While $myws.range("a" & $x).formula <> ""
    $name = $myws.range("a" & $x).formula
    $age = $myws.range("b" & $x).formula
$tmp = $tmp & $name & ' - ' & $age & @CRLF
$x = $x + 1
WEnd
MsgBox(0,"list","These are the names and ages listed" & @CRLF & $tmp)
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...