generate a list of list?

Hi
to set values in a Excel-range I need a list of a list (ExcelData):
{{v1},{v2},…,{vn}}
given a list (sInput) of values {v1,v2,…,vn}
I tried:

set ExcelData to {{}}
repeat n times
copy {sInput} to end of ExcelData
end repeat

but this code leads only to {v1,v2,…,vn} in ExcelData
How to do that?
Thanks

something like this

set ListToExcel to {}

repeat with rowNum from 1 to 10
	set oneRowsList to {}
	repeat with colNum from 1 to 10
		copy ("row-" & rowNum & ",col-" & colNum) to end of oneRowsList
	end repeat
	copy oneRowsList to end of ListToExcel
end repeat

tell application "Microsoft Excel"
	set value of range "A1:J10" to ListToExcel
end tell

Instead of using a repeat loop, getting the value of the entire range returns a nested list.
set range_values to the value of range “A1:A12”…

If you are given a list {v1,v2,v3,…v(r*c)} that you want to add to a sheet, you would need either the column or row count for the destination range. With that, you could do something like

set myList to {"v1", "v2", "v3", "v4", "v5", "v6"}

set rowsCount to 3

set myExcelList to {}
set pointer to 0
repeat with rowNum from 1 to rowsCount
	set oneRowsList to {}
	repeat with colNum from 1 to (count of myList) / rowsCount
		set pointer to pointer + 1
		copy item pointer of myList to end of oneRowsList
	end repeat
	copy oneRowsList to end of myExcelList
end repeat

tell application "Microsoft Excel"
	set value of (get resize range "a1" row size rowsCount column size ((count of myList) / rowsCount)) to myExcelList
end tell

Thank you both (also mikericson) for your hints.
But I have the revers question: I want send a list of values to a column in Excel. to send a row is easy: just copy the List to the Excel-range, but how to do the same with a column?

Set values_you_want_to_place to {{1,2}, {3,4}, {5,6}}
set the value of range “A1:B3” to values_you_want_to_place

… If I’m understanding the question.

not at all: My question is: how to build a list of {{v1},{v2},…,{vn}} in a repeat loop of n values.
I allways get {v1,v2,…vn}.

Do the scripts I posted help with setting up your desired list?

If you want to use a loop instead of referring to the range, mikerickson solution works.

How are use viewing the list?
Are you looking at the result window or are you putting a log statement in the event log?
They might return what seems to be different results.

Try getting the class of item 1 or your list.

On the first approach I didn’t understand, what the script does. So I tried it now “blind” - and yes, it works with a little modification! I’m now gooing to analyze and adapt it on my script.
Thank you very much! :slight_smile: