Hi there,
I’m currently in the process of adapting a script that I’d already written for pulling data out of Excel, concatenating it and using the resultant copy.
At present the script works with a fixed number of columns, I’ve included the code below:-
tell application "Microsoft Excel"
set startRow to 4
set endRow to 25
set address_list1 to value of range ("A" & startRow & ":A" & endRow)
set address_list2 to value of range ("B" & startRow & ":B" & endRow)
set address_list3 to value of range ("C" & startRow & ":C" & endRow)
set address_list4 to value of range ("D" & startRow & ":D" & endRow)
set address_list5 to value of range ("E" & startRow & ":E" & endRow)
end tell
What I’m wanting to end up with is a procedure that allows me to pass in a variable number of columns along with the start and end row, something like this:-
on my getCopy{"A,B,C,D,E",4,25}
Passing parameters into the procedure isn’t a problem I’d just like people’s thoughts on the best way to handle the data from Excel.
I was thinking something along the lines of looping through the A,B,C,D,E and putting the result of each in item1, item2, item3 … of a list.
Is this the best way to do it or can anyone think of a better alternative?
Thanks in advance,
Nick