Add a New Column

Add a New Column

Much like Add Cells to a Column or Add Codes to a Column, the Datavyu API allows you to create a completely new column using the createColumn() method. createColumn() takes at least two parameters: first, the name of the new column, followed by a list of the names of the new codes contained in the column.

For example, suppose you wanted to add a column called “look” to your spreadsheet. And you wanted “look” to contain two codes: direction and target.

  1. Set up the script, and create a new column with its two codes. You will need to create a Ruby object to hold the data until you are ready to write it back to the spreadsheet. In this example, the Ruby object is called look:

    require 'Datavyu_API.rb'
    begin
       # Create new column
       look = createColumn("look", "direction", "target")
    
  2. Write the new column back to the spreadsheet and end the script:

    require 'Datavyu_API.rb'
    begin
       look = createColumn("look", "direction", "target")
    
       # Write the new column to Datavyu's spreadsheet.
       setColumn(look)
    end