set_column()¶
- set_column(name, var)¶
set_column()
writes columns to the spreadsheet. For columns that already exist,set_column()
replaces the data in the spreadsheet with the version updated using the script. For instance, if you were to retrieve the “trial” column from a spreadsheet and then make some changes, you would useset_column()
to write those changes to the spreadsheet, replacing the old data with your new data.If the column does not already exist in the spreadsheet (for instance, if you create a new column using
makeNewColumn()
),set_column()
will instead create a new column in the spreadsheet.Parameter
Type
Description
name
String (optional)
Name of the column that you are inserting
column
RColumn
object (required)Ruby container of the column that you are inserting into the spreadsheet (modified output of
createNewColumn()
orgetColumn()
)Important
You must specify a value for the
column
parameter. If you are also passing a value for thename
parameter, the order of arguments must bename
followed bycolumn
.Returns
None
Example
The following example retrieves the Datavyu column “trial” and assigns it to a Ruby variable called
trial
. After some modifications to the trial object, it writes those changes back to the spreadsheet usingset_column()
.require 'Datavyu_API.rb' begin trial = getColumn("trial") <some modifications to trial> set_column("trial", trial) end