Excel Operations

Keyword: SETEXCELPATH

Description: This keyword or action instructs ICE to set the excel sheet location or the CSV file location for next keywords. This step is the mandatory first step for all @Excel keywords.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

setExcelPath

<File Path>; <Sheet Name (optional)>

(Optional)

  • Text

  • Static values

  • Dynamic variables

  • Input file can be: .xls, .xlsx and .csv

Find the snippet of the keyword below:

In the above example, after the test case debug, it sets the excel sheet location for next keywords and the execution status “True”/ “False” will be stored in variable {setExcelPath}.

Keyword: CLEAREXCELPATH

Description: This keyword or action instructs ICE to clear the excel file path or the CSV file path which was already set.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

clearExcelPath

NA

(Optional)

NA

Note: This keyword clears the excel path which was already set using “setExcelPath” keyword. Hence this keyword should be provided only after all excel action keywords.

Find the snippet of the keyword below:

In the above example, after the test case debug, it clears the excel path which was already set and the execution status “True”/ “False” will be stored in variable {clearExcelPath}.

Keyword: GETCOLUMNCOUNT

Description: This keyword or action instructs ICE to fetch the count of the total number of columns present in the specified excel or CSV file which have values and save the result in the output variable.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

getColumnCount

<Row number> (optional)

{Variable}

NA

Note:

  • The count will exclude the trailing empty cells.

  • If input value is not specified then this keyword fetches the count of all columns that contain text.

  • If input value specified is the row number then this keyword fetches the column count for the specified row number.

Find the snippet of the keyword below:

In the above example, after the test case debug, it fetches the count of the total number of rows present in the excel file which have value and store the result in variable {Excel_col}.

Keyword: GETROWCOUNT

Description: This keyword or action instructs ICE to fetch the count of the total number of rows present in the specified excel or CSV file which have values and save the result in the output variable.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

getRowCount

<Column Number (optional)>

{Variable}

NA

Note:

  • The count will exclude the trailing empty cells.

  • If input value is not specified then this keyword fetches the count of all rows that contain text.

  • If input value specified is the column number then this keyword fetches the row count for the specified column number.

Find the snippet of the keyword below:

In the above example, after the test case debug, it fetches the count of the total number of rows present in the excel file which have value and store the result in variable {Excel_row}.

Keyword: READCELL

Description: This keyword or action instructs ICE to read the content from the input column to the specified cell of the excel or CSV file.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

readCell

<rowNum>; <colNum>

{Variable}

  • Text

  • Static Values

  • Dynamic Variables

  • Supported column name as alphabets/ integers

Find the snippet of the keyword below:

In the above example, after the test case debug, it reads the content from the input column to the specified cell of the excel file and store the value in the variable {17_1} and the execution status “True”/ “False” will be stored in variable {readCell}.

Keyword: WRITETOCELL

Description: This keyword or action instructs ICE to write the content from the input column to the specified cell of the excel or CSV file.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

writeToCell

<rowNum>; <colNum>; <Value>; <Type>

(Optional)

  • Text

  • Static Values

  • Dynamic Variables

  • Supported column name as alphabets/integers

  • Supported Types are:

    • Number

    • Formula

    • Boolean

    • String

Find the snippet of the keyword below:

In the above example, after the test case debug, it writes the content from the input column to the specified cell of the excel file and the execution status “True”/ “False” will be stored in variable {writeToCell}.

Keyword: CLEARCELL

Description: This keyword or action instructs ICE to clear the content of the excel or CSV file cell given in the input.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

clearCell

<rowNum>; <colNum>;

(Optional)

  • Text

  • Static Values

  • Dynamic Variables

  • Supported column name as alphabets/ integers

Find the snippet of the keyword below:

In the above example, after the test case debug, it clears the content of the excel cell given in the input and the execution status “True”/ “False” will be stored in variable {clearCell}.

Keyword: DELETEROW

Description: This keyword or action instructs ICE to delete a particular row in the excel or CSV file.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

deleteRow

<rowNum>

(Optional)

  • Text

  • Static Values

  • Dynamic Variables

Find the snippet of the keyword below:

In the above example, after the test case debug, it deletes the 23rd row in the excel file and the execution status “True”/ “False” will be stored in variable {deleteRow}.

Keyword: COPYWORKBOOK

Description: This keyword or action instructs ICE to copy one excel file’s content to another.

Keyword

Input Syntax

Output Syntax

Supported Input Formats

copyWorkBook

<FilePath1>;<FiePath2>;<Option>(Optional);<text/special>(Optional)

(Optional)

  • Text

  • Static Values

  • Dynamic Variables

Note:

  1. The keyword supports copying the workbooks of file formats xlsx to xlsx and xls to xls only.

  2. The workbook specified in FilePath1 (source) is copied to the workbook specified in FilePath2 (destination).

  3. The copying of the workbooks can be changed based on the options provided below:

    • 0 or empty (default): This option will append the unique workbook sheets to the destination workbook and replace the workbook sheets with common names.

      For example,

      • WorkBook1 consists of Sheet1, Sheet2 and Custom_Sheet3.

      • WorkBook2 consists of Custom_Sheet1, Custom_Sheet2 and Custom_Sheet3.

      • After this option is used for the keyword, WorkBook2 will consist of Custom_Sheet1, Custom_Sheet2, Sheet1, Sheet2 and Custom_Sheet3 (overwritten from WorkBook1).

    • 1: This option will append all sheets irrespective of common names, by incrementing the sheet names.

      For example,

      • WorkBook1 consists of Sheet1, Sheet2 and Custom_Sheet3.

      • WorkBook2 consists of Custom_Sheet1, Custom_Sheet2 and Custom_Sheet3.

      • After this option is used for the keyword, WorkBook2 will consist of Custom_Sheet1, Custom_Sheet2, Custom_Sheet3, Sheet1, Sheet2 and Custom_Sheet3 (1).

    • 2: This option will copy all the sheets present in source workbook and paste it into the destination workbook, it will remove all previously existing data from destination workbook.

      For example,

      • WorkBook1 consists of Sheet1 and Sheet2.

      • WorkBook2 consists of Custom_Sheet1, Custom_Sheet2 and Custom_Sheet3.

      • After this option is used for the keyword, WorkBook2 will consist of Sheet1 and Sheet2.

  4. The copy method type (text/special) works as follows:

    • The ‘text’ option only copies the data. This method is not dependent on the system where the ICE is running.

    • The ‘special’ option copies all the data along with the formatting. This method is dependent on the system and will work only on Windows OS on which the Excel application is installed.

    • This argument is case insensitive.

    • Its default value depends on the systems OS.

      • If ‘copyWorkBook’ keyword is run on a Windows OS with Excel application and no value is provided by the user for this argument, then ‘special’ will be the default copy method type.

      • If ‘copyWorkBook’ keyword is run on any OS that is NOT Windows and no value is provided by the user for this argument, then ‘text’ will be the default copy method type.

Find the snippet of the keyword below:

In the above example, after the test case debug, the source workbook is copied to the destination workbook based on the option provided and the execution status “True” / “False” will be stored in the output variable (if provided).

Last updated