Example of using Custom column option in Data Table package

In this example, you will build a bot to read a CSV file, assign it to a data table variable, and then modify the table by adding a new column. Use the Custom column option in the Data Table package to insert columns at a specified index.

Prerequisites

Before you start building the bot, create a file in .CSV format using the data in the following table and save it as Data_table_input.csv.
Name Company Availability
Rene AA FALSE
Leote DG FALSE
Shane CV FALSE

Procedure

  1. Create a bot.
    1. On the left panel, click Automation.
      A list of available bots and forms is displayed.
    2. Click Create New > Bot.
    3. In the Create Task Bot window, enter a name for the bot: Datatable_test.
    4. Accept the default folder location: \Bots\. To change the default bot storage location, click Choose and follow the prompts.
    5. Click Create and Edit.
  2. Open and read data from the CSV file.
    1. Double-click or drag the CSV/TXT > Open action.
    2. In the Session name field, enter Session 1.
    3. In the File path field, click Browse to select your file.

      Select file from the file path

    4. Select the Contains header check box.
    5. In the Delimiter tab, select the Comma check box.
    6. Double-click or drag the CSV/TXT > Read action.
    7. In the Session name field, enter Session 1.
    8. In the Assign value to the variable field, create a table variable TableFromCSV to save the output.
    9. Double-click or drag the CSV/TXT > Close action.
  3. Insert a new column of data type String to the existing table.
    1. Double-click or drag the Data Table > Insert column action.
    2. In the Destination table field, select the variable TableFromCSV.
    3. From the Insert column at index field, select last index.
    4. From the Insert column option, select Custom column.
    5. In the Column name field, enter Address.
    6. In the Column type field, select the data type as String.
    7. In the Default value field, enter Bangalore.
  4. Write the new data to the CSV file.
    1. Double-click or drag the Data Table > Write to file action.
    2. In the Data table name field, select TableFromCSV variable.
    3. In the Enter file name field, select the CSV file that you have saved on your desktop.
    4. From the When writing field, select the Overwrite existing file option.
  5. Open the CSV file to view the updated data.
    1. Double-click or drag the Excel advanced > Open action.
    2. In the File tab, click Browse to select your file.
    3. Select the Sheet contains a header check box.
    4. Select the Read-write mode option to enable reading and editing of the file.
    5. Double-click or drag the Delay > Delay action.
    6. Enter a delay time of 5 seconds.
  6. Close the CSV file.
    1. Double-click or drag the Excel advanced > Close action.
    2. Select the Save changes when closing file option.
    3. In the Session name field, select the name of the session that you used to open the CSV file.
  7. Insert a new column of data type DateTime to the existing table.
    1. Double-click or drag the Data Table > Insert column action.
    2. In the Destination table field, select the variable TableFromCSV.
    3. From the Insert column at index field, select specific index and specify the index in the text field.
    4. From the Insert column option, select Custom column.
    5. In the Column name field, enter Date of joining.
  8. Open the CSV file to view the updated data.
    1. Double-click or drag the Excel advanced > Open action.
    2. In the File tab, click Browse to select your file.
    3. Select the Sheet contains a header check box.
    4. Select the Read-write mode option to enable reading and editing of the file.
    5. Double-click or drag the Delay > Delay action.
    6. Enter a delay time of 5 seconds.
  9. Close the CSV file.
    1. Double-click or drag the Excel advanced > Close action.
    2. Select the Save changes when closing file option.
    3. In the Session name field, select the name of the session that you used to open the CSV file.