Add Column

Verb: addColumn

Available from: <Standard>

Adds a new column to the specified data table.

Syntax

addColumn --dataTable(DataTable) --columnname(String) --type(String)

Inputs

Script Designer Required AcceptedTypes Description
--dataTable Data Table Required Data Table Data table that should receive the new column.
--columnname Column Name Required Text Name given to the new column.
--type Type Required Text Data type of the new column added to the data table.
  • Boolean;
  • Numeric;
  • String;
  • Date;
  • DateTime;
  • TimeSpan;
  • Money;
  • PhoneNumber.
  • Example

    Adds the "Year of Registration" column of the "Date" type to the data table. The Get Column Structure command is also used to demonstrate the columns in the table before and after Add Column.

    defVar --name excelFile --type Excel
    defVar --name excelTable --type DataTable
    defVar --name columnNameList --type List --innertype String
    // Download the following file to execute the command
    excelOpen --file "tableExcelCompanyCity.xlsx" excelFile=value
    excelGetTable --file ${excelFile} --getfirstsheet  --entiretable  --hasheaders  excelTable=value
    getColumns --dataTable ${excelTable} columnNameList=names
    logMessage --message "Table columns before addColumn: ${columnNameList}" --type "Info"
    addColumn --columnname "Year of Registration" --type Date --dataTable ${excelTable}
    getColumns --dataTable ${excelTable} columnNameList=names
    logMessage --message "Table columns after addColumn: ${columnNameList}" --type "Info"
    //Table columns before addColumn:
    //Company, City,
    //Table columns after addColumn:
    //Company, City, Year of Registration
    

    Download File

    See Also

  • Add Row
  • Check for Column Existence in Table
  • Copy Rows
  • Copy Table
  • Delete Column
  • Delete Rows
  • Filter Table
  • Find Column by Name
  • Find Table Cell Occurrences
  • Get Cell Contents
  • Get Column Name
  • Get Column Structure
  • Get HTML Tables
  • JSON to Table
  • Map Table Row
  • Move Table Rows
  • Sort Table
  • Update Row
  • Write Table to File