I want to store array elements in an Excel Sheet. How can I do that? Here is the sample code for an array:
for {set i 0} { $i < 3} {incr i} {
set color($i) $i
}
Now how can I store color(0), color(1), color(2) in different cells?
Edit: Based on this tcom example I have been trying to store array elements in an Excel Sheet.
Have a look at the commands
array set
andarray get
.Variable
nvList
has now the value0 0 1 1 2 2
(mind the comments). Witharray get
you get the Name-Value representation of an array. If you callarray set
you can convertnvList
to an array again.It this what you need?
Edit: Another example based on your comment:
Edit: Another (second) example based on your comment: