Is it possible to insert a list into numbers without having to iterate

Hi there,

If I have a list that is thousands of items long, can i put that list directly into a column, or do i need to iterate through each item in the list one at a time?


It’s odd but we can’t neither set nor get the value of a range to a list of values so we must use the good old GUI scripting.
Assuming that table 1 of sheet 1 contains 22 rows
and assuming that you want to insert values in column B starting from cell 15
The script below will do the job including the creation of required complementary rows.

set theList to {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}
# Fill the clipboard with values separated by linefeed character.
set the clipboard to my recolle(theList, linefeed)

tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
	set selection range to range "B15" # Define the first cell to fill
end tell

tell application "System Events" to tell process "Numbers"
	set frontmost to true
	keystroke "v" using {command down} # Paste in the table
end tell


on recolle(l, d)
	local oTIDs, t
	set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
	set t to l as text
	set AppleScript's text item delimiters to oTIDs
	return t
end recolle


Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 16 janvier 2019 18:52:59