set_column()

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 use set_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() or getColumn())

Important

You must specify a value for the column parameter. If you are also passing a value for the name parameter, the order of arguments must be name followed by column.

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 using set_column.

require 'Datavyu_API.rb'
begin
   trial = getColumn("trial")
   <some modifications to trial>
   set_column("trial", trial)
end