Couple question with Applescript

B

beevee

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: intel

I've wrote a script that grabs a weekly report from the web and imports the comma delimited text into a new workbook/worksheet. Reading through the Excel A-Script Dictionary it looks like working between workbooks isn't very intuitive so, how to I open the text file into an existing workbook?

Here's what I have now:

tell application "Microsoft Excel"
open text file filename thisWeek.csv data type delimited text qualifier text qualifier double quote with tab, comma and consecutive delimiter
save workspace workspace file name "myFile.xls"
activate object worksheet "newData"
end tell

tell application "Microsoft Excel"
open historicalData.xls
activate object worksheet 1
end tell

Each row in this weekly file corresponds to a worksheet in the workbook and I'm trying to figure out how to:

1.) Look at the first cell of each row for a keyword that corresponds to the worksheet variable names. For example, if the first cell contains the word "banana", check to see if a worksheet exists named "banana" and if not create a new worksheet called "banana".

2.) Look at another cell in the row for a date code and check that date code against the last row in the historical data worksheet and if the date is correct then copy the entire "banana" row to the next available row of that worksheet (which contains historical weekly "banana" data).

Then repeat for each row of the weekly file.

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top