combine_columns()

combine_columns()

combine_columns(name, *columnNames)

Combines two column together, creating a new column. create_mutually_exclusive combines the two source columns cells together so that the new column includes all of the arguments from both source columns. It also includes a combination of the two columns’ cells as well as a new cell for each overlap.

Parameter Type Description
name String The name of the new column you wish to create
columnNames List of strings The names of the source column that will be combined

Returns

The new Ruby representation of the column. You must write the changes back to the spreadsheet if you want to save them.

Example

The following example creates a column called “test” from two existing columns, “col1” and “col2”, and then writes the changes back to the spreadsheet using set_column.

require 'Datavyu_API.rb'
begin
   test = combine_columns("test", "col1", "col2")
   setColumn("test", test)
end