Scripting iWork Numbers problem

Hello

I am attempting to set the values of one column from one document to the column of another document. This is what I have so far:


tell the application "Numbers"
	tell the table "Table 1" of the sheet "Sheet 1" of the document "LockeWallace"
		set theData to the value of the cell of column "B"
		set theCount to the count of rows
	end tell
	set theFile to "MSPS:Assessments:Scoring:Locke-Wallace.numbers"
	tell the table "data" of the sheet "Locke-Wallace" of the document "Locke-Wallace.numbers"
		set theRange to cells 1 thru theCount of column "B"
		repeat with x in theData
			repeat with y in theRange
				set the value of cell y to (x as string)
			end repeat
		end repeat
	end tell
end tell

I keep playing with it but cannot get it to go. The current configuration gets;

The problem seems to be that the variable y is presented as a text (ie in “y”)

I have spent a lot of time on this and cannot see what I am missing.

Help

Model: MacBook
AppleScript: 2.3
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)

Hi, MSpsi.

Your variable theRange is set to a list of cells, so the value of y in the inner repeat is a reference to one of those cells in the list. The script’s erroring because it can’t convert y to a name or index to use in the expression cell y.

Also ” once that’s corrected ” the nested repeats would set the value of every cell in the column to each item of theData in turn. A single, indexed repeat is what’s needed:


tell the application "Numbers"
	tell the table "Table 1" of the sheet "Sheet 1" of the document "LockeWallace"
		set theData to the value of the cells of column "B"
		set theCount to the count of rows
	end tell
	set theFile to "MSPS:Assessments:Scoring:Locke-Wallace.numbers"
	tell the table "data" of the sheet "Locke-Wallace" of the document "Locke-Wallace.numbers"
		repeat with i from 1 to theCount
			set value of cell i of column "B" to item i of theData
		end repeat
	end tell
end tell

:lol: worked!!! Thanks