Simple Newbie Question #1

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Shevs
Newbie
Posts: 6
Joined: Thu Jan 17, 2013 11:27 pm

Simple Newbie Question #1

Post by Shevs » Sat Dec 20, 2014 9:26 pm

Hi there, I have a really simple thing I'd like to do. I want to enter data from excel into something else. I want it to go each row and enter the value in the 2nd column.

Currently I have this:

//Specify the path of the Excel file here
Let>filename=C:\Documents and Settings\vanderwey\Desktop\two.xls
IfFileExists>filename
XLOpen>two.xls,1,xlH
//Ask how many rows we should get
Input>maxrows,How many rows shall I get?,200
If>maxrows=0
Exit>0
Endif

//Data starts on row 2 - row 1 has header
Let>row=1
Repeat>row
Let>row=row+1
//get the fields for this row
XLGetCell>xlH,Sheet1,row,2,field_2
//For this example we'll just paste each row into Notepad
SetFocus>Notepad*
Send>field_1
Press Enter
//you'll want to replace the above lines to send the data to your real app.
Wait>0.05
Until>row>maxrows
Else
MessageModal>Could not find: %filename%
Endif


But it is returning field_1

I want it to be whatever is in the cell.

Thanks in advance, I really appreciate it.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Simple Newbie Question #1

Post by JRL » Sun Dec 21, 2014 1:37 am

You need the full path to your file. In the XLOpen> line, replace "two.xls" with the variable "filename".

XLOpen>filename,1,xlH

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts