Applescript - Copying and pasting in Numbers sheet

I am using AppleScript to consolidate four spreadsheets into one. Right now, I am adding enough rows to the first spreadsheet to accommodate the rows of the others, but this means I have to add over 100 rows to the first sheet. I'm using a repeat loop to add the rows one at a time.

 

  -- Add rows

  tell application "Numbers" to tell table 1 of sheet 1 of document 1

  repeat numRowsToAdd times

  add row below last row

  end repeat

  end tell


My first question: Is there a better way to add the rows?


To transfer the subsequent sheets to the first sheet, I'm setting a selection to the cell range of each sheet, then doing a copy and paste by sending keystroke messages to System Events:

 

  -- Copy the range

  tell application "System Events" to keystroke "c" using command down


The paste instruction is similar.


My second question is the same: Is there a better way to move the data to the first sheet? The System Events approach seems kinda clunky.


Thanks for your help!


iMac, 27" Late 2013
Has invited:

howapple - hello

Favor from:


Right - the copied area will be pasted starting at the selected cell and extending down and to the right. The table will automatically expand to accommodate the new data, either by adding new row or new columns as appropriate.

To reply to a question, please Login or registered