Referencing Excel Spreadsheets...

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Referencing Excel Spreadsheets...

Post by rjw524 » Thu Apr 25, 2013 3:54 am

Hi,

I'm getting much better with this thing, so thanks to Marcus and everyone here!

Ok, I've been using keystrokes to reference excel spreadsheets for information (I know...bad newbie coder! bad!).

Basically, 90% of my macro needs involve one of two things:

1) taking data from excel spreadsheets and inputing that data into various fields on webpages

or

2) Taking data from webpages and pasting it into excel...

I'm seeing the limitations and clumsiness of going back and forth to open excel spreadsheets.

So, I've tried working with the XL and Database commands but I'm having difficulty.

MY PROBLEM:

I have let's say...500 records in an Excel spreadsheet. Each record (Row) has 15 columns worth of data and each column has the same info for that record up and down.

Excel Spreadsheet Example:

(Each comma represents a new column obviously...)

A, B, C, D, E, F, G, H,
1 # First, Last, Company, Title, Phone, Email, City,
2 1) Clark, Kent, Daily Planet, Reporter, (212)..., ckent, Metropolis
2 2) Peter, Parker, Daily Bugle, Photos, (718)..., pparker, New York
3 3) Lois, Lane, Daily Planet, Reporter, (212)..., llane, Metropolis
4 4) ...
.
.
.
Row 501

(You get the idea :) )

My macro needs to take that data, cell by cell, and enter it into an online database. NOTE: The database DOES NOT have a batch import function or something of the like.

I have to fill out the webform for each record and each form has fields that correspond to the data in the excel sheet.

So, I am having trouble using the XL commands to reference each field in the spreadsheet and go to the next record.


I'D LIKE THE MACRO TO DO THE FOLLOWING STEPS:

1) Take the FirstName in Row X and paste it in the correct field on the webform. (So, "B2" in the example above.)

2) Reference the LastName Column in Row X on the excel sheet and paste it into the LastName field on the Webform and

3) Keep going until it has filled out the webform and after submitting it,

4) Go to the next row (Row X+1) and do steps 1,2 and 3 over again.

5) Stop when there are no more records.

6) Optional: (If there's a way to tell it at which row to start each time that would be great, but not necessary).


Like I said, I'm using keystrokes to do this currently and would like to get away from doing that.

I am using MacSch 13 and have Windows 7.

Can anyone help with some basic coding examples for doing those steps?

Thanks!

R.J.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Apr 26, 2013 8:12 am

There's a sample script that comes with Macro Scheduler called:

"Extract From Excel"

The code in that script should answer your questions. It loops through a sheet row by row and pulls out several different columns from each row and then sends it into Notepad.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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