SAP Help Home SAP Intelligent RPA Help Portal SAP Intelligent RPA Community

Module - Worksheet

Set of activities related to MS Excel worksheet. Use the Worksheet activities to read (get) or write (set) cells with different options.

Activities

Add Worksheet

Add a new worksheet to the ACTIVE workbook.


Technical Name Type Minimal Agent Version
addNewWorksheet synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
worksheetName string mandatory Name of the worksheet to add.

Sample Code:

irpa_excel.worksheet.addNewWorksheet('myWorksheetName');

Errors:

Error Class Package Description
SequenceError irpa_core Please open Excel before to perform any activity.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Active Worksheet Name

Get the name of the active worksheet.


Technical Name Type Minimal Agent Version
getActiveWorksheetName synchronous WIN-2.0.0

Output Parameters:

Name Type Description
activeSheetName string Name of the active worksheet.

Sample Code:

const activeWorksheetName = irpa_excel.worksheet.getActiveWorksheetName();

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook? Do you have an active worksheet in the active workbook.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Rename Worksheet

Rename a worksheet on the ACTIVE workbook.


Technical Name Type Minimal Agent Version
renameWorksheet synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
newWorksheetName string mandatory The worksheet name to rename.

Sample Code:

irpa_excel.worksheet.renameWorksheet('myNewWorksheetName');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook?
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Unprotect Worksheet

Unprotect current worksheet on the ACTIVE workbook.


Technical Name Type Minimal Agent Version
unprotectWorksheet synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
protectPassword password optional Optional. Password required to unprotect a worksheet.

Sample Code:

irpa_excel.worksheet.unprotectWorksheet('password');

Note:

If no password is input and the worksheet requires a password, the user is prompted for the password with an uncatchable popup.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook?
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Protect Worksheet

Protect current worksheet on the ACTIVE workbook.


Technical Name Type Minimal Agent Version
protectWorksheet synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
protectPassword password optional Optional. Password required to protect a worksheet.
allows irpa_excel.allowOnProtectedWorksheetDatatype optional Allow some user actions on a protected Worksheet.

Sample Code:

irpa_excel.worksheet.protectWorksheet('password', allowOnProtectedWorksheetDescription);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook?
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Activate Worksheet

Set the ACTIVE worksheet of the ACTIVE workbook. Once activated, further operations might be possible such as Get Values or Set Values which require an active workbook defined.


Technical Name Type Minimal Agent Version
activateWorksheet synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
worksheetName string mandatory Name of the worksheet to activate.

Sample Code:

irpa_excel.worksheet.activateWorksheet('myWorksheetName');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook?
InvalidArgument irpa_core Worksheet could not be found in the current workbook.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Delete Worksheet

Delete a worksheet on the ACTIVE workbook. Once deleted, the next worksheet is set as active.


Technical Name Type Minimal Agent Version
deleteWorksheet synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
worksheetName string optional The name of the worksheet to delete. If not filled, the active worksheet will be deleted.

Sample Code:

irpa_excel.worksheet.deleteWorksheet('myWorksheetName');

Note:

If you don't specify a worksheet, the active worksheet is deleted. Then, the active worksheet is defined by the Excel behavior.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook? Is there an active worksheet in the workbook?
NotFound irpa_core The worksheet has not been found. Verify the worksheetName or check if a worksheet is existing in the workook.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Duplicate Worksheet

Duplicate the active worksheet from the ACTIVE workbook to the destination workbook. The duplicated worksheet is set as active worksheet by this activity. The duplicated worksheet will be on the right hand side of the original worksheet.


Technical Name Type Minimal Agent Version
duplicateWorksheet synchronous WIN-2.0.0

Sample Code:

irpa_excel.worksheet.duplicateWorksheet();

Note:

The duplicated worksheet is considered as the active worksheet as soon as the duplication is done.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook?
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Move Worksheet

Move the active worksheet from the ACTIVE workbook. It can be moved in a workbook which is not the active one. The moved worksheet is set as active worksheet by this activity. If a destination workbook has been defined, it will be set as active by this activity.


Technical Name Type Minimal Agent Version
moveWorksheet synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
moveType irpa_excel.enums.worksheetMoveType optional firstPosition Select the type of move that is expected.
referenceWorksheet string optional Name of the worksheet which should be next (Left or Right) to the moved worksheet.
destinationWorkbook string optional The name or the path of the destination workbook. If not filled, the current workbook is used.

Sample Code:

irpa_excel.worksheet.moveWorksheet();

Note:

If a destination workbook is defined, the destination workbook will be set as active workbook by this activity.

Note:

The moved worksheet will be set as active worksheet by this activity.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open or create a workbook?
InvalidArgument irpa_core Are you sure about the value of moveType ?
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Values (Cells)

Return (read) the values of a specified cell range in the ACTIVE worksheet.


Technical Name Type Minimal Agent Version
getValues synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
defaultValue any optional Default value with which to fill the empty cells.
getFormat irpa_excel.enums.getFormat optional standard Select the format of the output.
visibleOnly boolean optional false Set to true to read only displayed values in case of filtering (or if rows or columns are hidden).
dateFormat irpa_excel.enums.dateFormats optional object Format returned for date cells. The default object is a JavaScript object for describing a date. The ISO string is a string such as yyyy-mm-ddT00.00.000Z. The local date string can be in format dd/mm/yyyy, depending on the local format.

Output Parameters:

Name Type Description
returnedValues any Values of the range given in the parameters.

Sample Code:

const rangeValues = irpa_excel.worksheet.getValues("A1:I8", '');

Note:

If getFormat is set to 'reduceToList', if the required range is a range with a unique column, or a unique row, the returnedValues will be returned as a list (instead of a list of list). Note as well that an empty cell will correspond to an undefined value in the result list.

Note:

If the rangeDefinition corresponds to a unique cell, the returned value is a unique value (the result is not a list or a list of list).

Note:

The parameter visibleOnly equals to true can have an impact on the performance.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Values (Cells)

Set (write) the values of a specified cells range in the ACTIVE worksheet.


Technical Name Type Minimal Agent Version
setValues synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
values any mandatory Values to write.
listDirection irpa_excel.enums.listDirection optional vertical Define how a single list will be written on the worksheet if the “rangeDefinition” parameter is just set to one cell.

Sample Code:

irpa_excel.worksheet.setValues("A1:C4", [[1, 2, 3, 4], [5, 6, 7, 8], ['nine', 'ten', 'eleven', 'twelve']]);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Push Values

Push (write) the values in the ACTIVE worksheet: started from the active cell and then the active cell is moved to be ready for the next push.


Technical Name Type Minimal Agent Version
pushValues synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
values any mandatory Values to write.
moveDirection irpa_excel.enums.moveDirection optional vertical Choose the direction to use when the activity is used multiple times.
listDirection irpa_excel.enums.listDirection optional Define how a single list will be written on the worksheet.
additionalOffset number optional 0 Number of lines to add before the next writing.

Sample Code:

// write a 2-D array and move vertically excel.worksheet.pushValues([[1,2], [3,4]], irpa_excel.enums.moveDirection.vertical);

Sample Code:

// write a single array horizontally and move vertically excel.worksheet.pushValues([1,2, 3, 4], irpa_excel.enums.moveDirection.vertical, irpa_excel.enums.listDirection.horizontal);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidArgument irpa_core In case of singleArray, listDirection is missing or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Formulas (Cells)

Retrieve (read) the formulas of a specified cells range in the ACTIVE worksheet.


Technical Name Type Minimal Agent Version
getFormulas synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. For example, 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.

Output Parameters:

Name Type Description
returnedFormulas any The formulas of the range given in the parameters.

Sample Code:

//get formulas from A1 to I8. const rangeValues = irpa_excel.worksheet.getFormulas("A1:I8", '');

Note:

An empty cell will correspond to an undefined formula in the result.

Note:

If the rangeDefinition corresponds to a unique cell, the returned formula is a unique formula (the result is not a list or a list of list).

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Formulas (Cells)

Set (write) the formulas of a specified cells range in the ACTIVE worksheet.


Technical Name Type Minimal Agent Version
setFormulas synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. For example, 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
formulas any mandatory The formulas to write.

Sample Code:

//write formulas on the range A2:B3 irpa_excel.worksheet.setFormulas('A2:B3', [['=3', '=sum(3,5)'], ['=average(4,6,8)', '="text"']]);

Note:

The formulas should correspond to "English" Microsoft Excel formulas.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Note (Cell)

Return (read) the note of a specified cell in the ACTIVE worksheet.


Technical Name Type Minimal Agent Version
getNote synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellDefinition string mandatory The definition of the cell. A;8 or 1;8 or A8 (must be a single cell).

Output Parameters:

Name Type Description
returnedNote string The note of the cell defined in the parameters.

Sample Code:

//get note of A1 cell. const note = irpa_excel.worksheet.getNote("A1");

Note:

An cell with no note will correspond to an undefined note in the result.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid, has multiple cells or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Note (Cell)

Set (write) the note of a specified cell range in the ACTIVE worksheet. If the range has multiple cells, only the top-left cell of the range will be affected.


Technical Name Type Minimal Agent Version
setNote synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
noteText string mandatory The note to write.

Sample Code:

//write a note on the cell A1 irpa_excel.worksheet.setNote('A1:B2', 'This is my note');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Active Cell

Set the active cell in an ACTIVE worksheet.


Technical Name Type Minimal Agent Version
moveActiveCell synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellDefinition any mandatory Address of the cell to select.

Sample Code:

//move the active cell to F5 cell. irpa_excel.worksheet.moveActiveCell("F5");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter cellDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Clear Cells

Clear cells, or ranges of cells, in an Excel worksheet.


Technical Name Type Minimal Agent Version
clear synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
clearContents boolean optional false Set this parameter to 'true' to clear the content of the cells or ranges of cells.
clearNotes boolean optional false Set this parameter to 'true' to clear the notes of the cells or ranges of cells.
clearFormats boolean optional false Set this parameter to 'true' to clear the formats of the cells or ranges of cells.
clearHyperlinks boolean optional false Set this parameter to 'true' to clear the hyperlinks of the cells or ranges of cells.

Sample Code:

irpa_excel.worksheet.clear("A8:K30", true, false, false, false);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Row From Data

Retrieve dynamically the last (or first) row from a group of data from a reference cell.


Technical Name Type Minimal Agent Version
range.getRowFromData synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
referenceCell any optional The address of the cell to start with. If not filled, the active cell is used instead.
verticalDirection irpa_excel.enums.XlVerticalDirection optional xlDown The vertical direction to look for at the end of the group of data.

Output Parameters:

Name Type Description
rowIndex number Excel index of the last (or first) row of the corresponding cells block.

Sample Code:

//get the row index of the last row of the group of data from the reference F5 cell. irpa_excel.worksheet.range.getRowFromData("F5", 'irpa_excel.enums.XlVerticalDirection.xlDown);

Note:

Equivalent to pressing manually CTRL + UP ARROW, CTRL + DOWN ARROW in the Excel worksheet.

Note:

If the referenced cell is empty, the active cell of the active worksheet is used instead.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter referenceCell is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Column From Data

Retrieve dynamically the last column from a group of data from a reference cell.


Technical Name Type Minimal Agent Version
range.getColumnFromData synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
referenceCell any optional The address of the cell to start with. If not filled, the active cell is used instead.
horizontalDirection irpa_excel.enums.XlHorizontalDirection optional xlToRight The horizontal direction to look for at the end of the group of data.

Output Parameters:

Name Type Description
columnIndex number Excel index of the last (or first) row of the corresponding cells block.

Sample Code:

//get the column index of the last used range from the reference F5 cell. irpa_excel.worksheet.range.getColumnFromData("F5", 'irpa_excel.enums.XlHorizontalDirection.xlRight);

Note:

Equivalent to pressing manually CTRL + LEFT ARROW, or CTRL + RIGHT ARROW in the Excel worksheet.

Note:

If the referenced cell is empty, the active cell of the active worksheet is used instead.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter referenceCell is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get UsedRange Row

Retrieve the row index of the used range in an active excel worksheet.


Technical Name Type Minimal Agent Version
range.getUsedRangeRow synchronous WIN-2.0.0

Output Parameters:

Name Type Description
usedRangeRowIndex number Row index of the used range in the active worksheet.

Sample Code:

//get the row index of the used range in the active excel worksheet. const myRowIndex = irpa_excel.worksheet.range.getUsedRangeRow();

Note:

Equivalent to pressing manually CTRL + END and getting the row of the active cell.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get UsedRange Column

Retrieve the column index of the used range in an active excel worksheet.


Technical Name Type Minimal Agent Version
range.getUsedRangeColumn synchronous WIN-2.0.0

Output Parameters:

Name Type Description
usedRangeColumnIndex number Column index of the used range in the active worksheet.

Sample Code:

//get the column index of the used range in the active excel worksheet. const myColumnIndex = irpa_excel.worksheet.range.getUsedRangeColumn();

Note:

Equivalent to pressing manually CTRL + END and getting the column of the active cell.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Select Range

Select the range in an active worksheet.


Technical Name Type Minimal Agent Version
range.selectRange synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.

Sample Code:

//Select the range D2:H32 irpa_excel.worksheet.range.selectRange("D2:H32");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Copy Range

Copy the range and paste it immediately if required.


Technical Name Type Minimal Agent Version
range.copyRange synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. For example, 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
destinationRange string mandatory The definition of the range where you expect to paste the range. For easier use, please specify the top left cell only.
destinationWorksheet string optional The name of an existing worksheet containing the destination range for the paste process.
destinationWorkbook string optional The name of an opened workbook in the same Excel instance containing the destination range for the paste process.

Sample Code:

//Copy the range B2:G6 and paste it inside the worksheet 'myWorksheet' into H1:M5 irpa_excel.worksheet.range.copyRange("B2:G6", "H1", "myWorksheet");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Row

Retrieve the row index from a cell address.


Technical Name Type Minimal Agent Version
range.getRow synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
referenceCell string optional The address of the cell to use to get the row index. If not filled, the active cell is used instead.

Output Parameters:

Name Type Description
rowIndex number Excel row index of the referenceCell (or of the active cell if referenceCell is empty).

Sample Code:

//get the row index from the F5 cell. Returns 5. const rowIndex = irpa_excel.worksheet.range.getRow("F5");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter referenceCell is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Column

Retrieve the column index from a cell address.


Technical Name Type Minimal Agent Version
range.getColumn synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
referenceCell string optional The address of the cell to use to get the column index. If not filled, the active cell is used instead.

Output Parameters:

Name Type Description
columnIndex number Excel row column of the referenceCell (or of the active cell if referenceCell is empty)

Sample Code:

//get the column index from the K5 cell. Returns 16384. const columnIndex = irpa_excel.worksheet.range.getColumn("XFD5");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter referenceCell is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Column Name

Retrieve the column text index from a cell address.


Technical Name Type Minimal Agent Version
range.getColumnName synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
referenceCell string optional The address of the cell to use to retrieve the column index. If not filled, the active cell is used instead.

Output Parameters:

Name Type Description
columnName string Excel column text index of the referenceCell (or of the active cell if referenceCell is empty).

Sample Code:

//get the column index from the K5 cell. Returns XFD. const columnName = irpa_excel.worksheet.range.getColumnName("XFD5");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter referenceCell is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Convert Column Index to Name

Convert a column index number into a column name.


Technical Name Type Minimal Agent Version
range.convertColumnIndexToName synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
columnIndex number mandatory The index number of an Excel column.

Output Parameters:

Name Type Description
columnName string Excel column name corresponding to the columnIndex set as an input.

Sample Code:

//Convert 11 to the corresponding column name. Returns K. const columnName = irpa_excel.worksheet.range.convertColumnIndexToName(11);

Errors:

Error Class Package Description
SequenceError irpa_core Please open Excel before to perform any activity.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Convert Column Name to Number

Convert an Excel column name into an index number.


Technical Name Type Minimal Agent Version
range.convertColumnNameToNumber synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
columnName string mandatory The text index of an Excel column. e.g. 'X' or 'SH'.

Output Parameters:

Name Type Description
columnIndex number Excel column coordinate as a number.

Sample Code:

//Convert K to the corresponding number. Returns 11. const columnIndex = irpa_excel.worksheet.range.convertColumnNameToNumber("K");

Errors:

Error Class Package Description
SequenceError irpa_core Please open Excel before to perform any activity.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Range Information

Extract and calculate information from a range definition.


Technical Name Type Minimal Agent Version
range.getRangeInformation synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.

Output Parameters:

Name Type Description
rangeInformation irpa_excel.rangeInformation Contains useful information to describe the range.

Errors:

Error Class Package Description
SequenceError irpa_core Please open Excel before to perform any activity.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Number Format (Cell)

Set the number format to change the display of numbers, dates, etc.


Technical Name Type Minimal Agent Version
formatter.setNumberFormat synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
numberFormat string mandatory The format representing the expected formatting for the numbers in the Microsoft Excel cells corresponding to the parameter rangeDefinition.

Sample Code:

//expect to display 74 in the cell A1 as 74.00 irpa_excel.worksheet.formatter.setNumberFormat('A1', '0.00');

Sample Code:

//expect to display 2020-10-8 (ISO format) in the cell A1 as 10/8/20 irpa_excel.worksheet.formatter.setNumberFormat('A1', 'm/d/yy');

Sample Code:

//expect to display 2020-10-8 (ISO format) in the cell A1 as 8/10/2020 irpa_excel.worksheet.formatter.setNumberFormat('A1', 'd/m/yyyy');

Sample Code:

//expect to display 0.12 in the cell A1 as 12% irpa_excel.worksheet.formatter.setNumberFormat('A1', '0.00%');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Number Format (Cell)

Get the number format of a cell range. If all the cells in the range don't have the same number format, the result is null.


Technical Name Type Minimal Agent Version
formatter.getNumberFormat synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.

Output Parameters:

Name Type Description
numberFormat string Number (in string format) of the cells in the range.

Sample Code:

irpa_excel.worksheet.formatter.getNumberFormat('A1');

Sample Code:

irpa_excel.worksheet.formatter.getNumberFormat('A1:B2');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Bold (Cell)

Format the content in bold for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontBold synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
boldValue boolean mandatory True to set bold formatting, false to remove it.

Sample Code:

irpa_excel.worksheet.formatter.formatFontBold("A1:C4", true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core The input parameter boldValue should be a boolean.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Italic (Cell)

Format the content in italic for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontItalic synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
italicValue boolean mandatory True to set italic formatting, false to remove it.

Sample Code:

irpa_excel.worksheet.formatter.formatFontItalic("A1:C4", true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core The input parameter italicValue should be a boolean.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Underline (Cell)

Format the content in underline for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontUnderline synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
underlineStyle irpa_excel.enums.XlUnderlineStyle optional xlUnderlineStyleSingle Use “irpa_excel.enums.XlUnderlineStyle” enumeration to choose a style. The default is “XlUnderlineStyle.xlUnderlineStyleSingle”.

Sample Code:

irpa_excel.worksheet.formatter.formatFontUnderline("A1:C4", irpa_excel.enums.XlUnderlineStyle.xlUnderlineStyleSingle);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core underlineStyle parameter is invalid. Please use irpa_excel.enums.XlUnderlineStyle to chose a style.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Strikethrough (Cell)

Format the content in strikethrough for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontStrikethrough synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
strikethroughValue boolean mandatory True to set strikethrough formatting, false to remove it.

Sample Code:

irpa_excel.worksheet.formatter.formatFontStrikethrough("A1:C4", true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core strikethroughValue should be a boolean.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Subscript (Cell)

Format the content in subscript for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontSubscript synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
subscriptValue boolean mandatory True to apply subscript, false to remove it.

Sample Code:

irpa_excel.worksheet.formatter.formatFontSubscript("A1:C4", true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core subscriptValue should be a boolean.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Superscript (Cell)

Format the content in superscript for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontSuperscript synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
superscriptValue boolean mandatory True to apply superscript, false to remove it.

Sample Code:

irpa_excel.worksheet.formatter.formatFontSuperscript("A1:C4", true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core superscriptValue should be a boolean.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Text Size (Cell)

Format the text font size for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontSize synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
fontSizeValue number mandatory Size of the font to apply.

Sample Code:

irpa_excel.worksheet.formatter.formatFontSize("A1:C4", 24);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core The input parameter fontSizeValue should be a positive number.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Text Alignment (Cell)

Format the text alignment and text position for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatAlignment synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
alignmentType irpa_excel.enums.XlHAlign optional xlHAlignJustify Use the list in “irpa_excel.enums.XlHAlign” enumeration to choose the alignment to apply.

Sample Code:

irpa_excel.worksheet.formatter.formatAlignment("A1:C4", irpa_excel.enums.XlHAlign.xlHAlignJustify);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core alignmentType is invalid. Please use the enum irpa_excel.enums.XlHAlign.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Background Color (Cell)

Format the background color for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatBackgroundColor synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
colorToApply irpa_excel.enums.color.rgb mandatory Color to apply in the background. You can use the 𠇎nums.color.rgb” enumeration to select predefined colors.

Sample Code:

irpa_excel.worksheet.formatter.formatBackgroundColor("A8:K30", irpa_excel.enums.color.rgb.lightBlue);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core colorToApply is invalid. Please use the enum irpa_excel.enums.color.rgb
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Format Font Color (Cell)

Format the text font color for a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatFontColor synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
colorToApply irpa_excel.enums.color.rgb mandatory Color to apply. You can use the 𠇎nums.color.rgb” enumeration to select predefined colors.

Sample Code:

irpa_excel.worksheet.formatter.formatFontColor("A8:K30", irpa_excel.enums.color.rgb.lightBlue);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
InvalidArgument irpa_core colorToApply is invalid. Please use the enum irpa_excel.enums.color.rgb
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Format (Cell)

Apply a set of formatting properties to a specified cell range of the ACTIVE workbook.


Technical Name Type Minimal Agent Version
formatter.formatAll synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory Definition of cell ranges. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
bold boolean optional True to set bold formatting, false to remove it.
italic boolean optional True to set italic formatting, false to remove it.
underline irpa_excel.enums.XlUnderlineStyle optional Use “irpa_excel.enums.XlUnderlineStyle” enumeration to choose a style.
fontSize number optional Size of the font to apply.
alignmentType irpa_excel.enums.XlHAlign optional Use the list in “irpa_excel.enums.XlHAlign” enumeration to choose the alignment to apply.
backgroundColor irpa_excel.enums.color.rgb optional Color to apply in the background. You can use the 𠇎nums.color.rgb” enumeration to select predefined colors.
fontColor irpa_excel.enums.color.rgb optional Color to apply to the font. You can use the 𠇎nums.color.rgb” enumeration to select predefined colors.
strikethrough boolean optional True to set strikethrough formatting, false to remove it.
subscript boolean optional True to set subscript, false to remove it.
superscript boolean optional True to apply superscript, false to remove it.

Sample Code:

irpa_excel.worksheet.formatter.formatAll(formatProperties);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter rangeDefinition is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Row Height

Retrieve the row height of the reference cell or the active cell.


Technical Name Type Minimal Agent Version
rows.getRowHeight synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellReference string optional The cell reference to specify the row to focus on. For example, A;8 or 1;8 or A8 for a single cell. If not defined, the active cell is used.

Output Parameters:

Name Type Description
rowHeight number The height of the row index of the reference cell.

Sample Code:

//Get the height of the row 49. irpa_excel.worksheet.rows.getRowHeight("H49");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the cellReference corresponds to a correct row index or a valid cell address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Row Height

Set the row height of the reference cell or the active cell.


Technical Name Type Minimal Agent Version
rows.setRowHeight synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeReference string mandatory The range reference to specify the rows to focus on. For example, 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range, A;8 or 1;8 or A8 for a single cell. If not defined, the active cell is used.
newHeight number optional The new height to set to the rows corresponding to the range reference.
autofit boolean optional Set to true to activate the autofit feature. In this case, the newHeight parameter is not taken into account.

Sample Code:

//set the height of the row 49 to 25. irpa_excel.worksheet.rows.setRowHeight("H49", 25);

Sample Code:

//set the height of the active cell row to 18. irpa_excel.worksheet.rows.setRowHeight(undefined, 18);

Sample Code:

//set the height of the rows 20 to 50 according to their content. irpa_excel.worksheet.rows.setRowHeight("A20:X50", undefined, true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Hide Rows

Hide the rows corresponding to the reference range or the active cell.


Technical Name Type Minimal Agent Version
rows.hideRows synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeReference string mandatory The range reference to specify the rows to focus on. For example, 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range, A;8 or 1;8 or A8 for a single cell. If not defined, the active cell is used.
hide boolean optional true Set to true to hide rows, false to unhide rows.

Sample Code:

//hide the row 49 irpa_excel.worksheet.rows.hideRows("H49", true);

Sample Code:

//hide the rows from 4 to 79 irpa_excel.worksheet.rows.hideRows("B4:G79", true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Insert Rows

Insert rows in the active worksheet.


Technical Name Type Minimal Agent Version
rows.insertRows synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellReference string optional The range reference to specify the row to focus on. For example, A;8 or 1;8 or A8 for a single cell. If not defined, the active cell is used.
numberOfRows number optional 1 Specify how many rows you want to add (1 by default).
clearFormats boolean optional false If set to true, the new rows will have no format. If set to false (default), the new rows will have the same format than the row corresponding to the cellReference parameter.

Sample Code:

//insert 2 rows from row 4. That means row 4 and 5 will be added. irpa_excel.worksheet.rows.insertRows("H4", 2);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the cellReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Delete Rows

Delete rows in Excel. The shift of the cells below the deleted rows is up.


Technical Name Type Minimal Agent Version
rows.deleteRows synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeReference string mandatory The range reference to specify the rows to focus on. 'For example, A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.

Sample Code:

//delete the rows from 49 to 120. irpa_excel.worksheet.rows.deleteRows("H49:Z120");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Column Width

Retrieve the column width of the reference cell or of the active cell.


Technical Name Type Minimal Agent Version
columns.getColumnWidth synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellReference string optional The cell reference to specify the column to focus on. For example, A;8 or 1;8 or A8 for a single cell. If not defined, the active cell is used.

Output Parameters:

Name Type Description
columnWidth number The width of the column corresponding to the reference cell.

Sample Code:

//Get the width of the column H. irpa_excel.worksheet.columns.getColumnWidth("H49");

Sample Code:

//Get the width of the column of the active cell. irpa_excel.worksheet.columns.getColumnWidth();

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the cellReference corresponds to a correct row index or a valid cell address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Set Columns Width

Set the column width of the reference cells or of the active cells.


Technical Name Type Minimal Agent Version
columns.setColumnWidth synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeReference string mandatory The range reference to specify the columns to focus on. For example, 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range, A;8 or 1;8 or A8 for a single cell. If not defined, the active cell is used.
newWidth number optional The new width to set to the columns corresponding to the range reference.
autofit boolean optional Set to true to activate the autofit feature. In this case, the newWidth parameter is not taken into account.

Sample Code:

//set the width of the column H to 25. irpa_excel.worksheet.columns.setColumnWidth("H49", 25);

Sample Code:

//set the width of the column of the active cell to 18. irpa_excel.worksheet.columns.setColumnWidth(undefined, 18);

Sample Code:

//set the width of the columns from 20 to 50 according to their content. This is called 'autofit'. irpa_excel.worksheet.rows.setColumnWidth("A20:X50", undefined, true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Hide Columns

Hide the columns corresponding to the reference range or the active cell.


Technical Name Type Minimal Agent Version
columns.hideColumns synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeReference string optional The range reference to specify the columns to focus on. For example, 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell. If not defined, the active cell is used.
hide boolean optional true True to hide the columns, false to unhide the columns.

Sample Code:

//hide the column H irpa_excel.worksheet.columns.hideColumns("H49", true);

Sample Code:

//hide the columns from B to G irpa_excel.worksheet.columns.hideColumns("B4:G79", true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Insert Columns

Insert columns in the active worksheet.


Technical Name Type Minimal Agent Version
columns.insertColumns synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellReference string optional The range reference to specify the column to focus on. For example, A;8 or 1;8 or A8 for a single cell. if not defined, the active cell is used.
numberOfColumns number optional 1 Specify how many columns you want to add (1 by default).
clearFormats boolean optional false If set to true, the new columns will have no format. If set to false (default), the new columns will have the same format than the row corresponding to the cellReference parameter.

Sample Code:

//insert 2 columns from column P. That means columns P and Q will be added. irpa_excel.worksheet.columns.insertColumns("P4", 2);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the cellReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Delete Columns

Delete columns in Excel. The shift of the cells on the right of the deleted columns is left.


Technical Name Type Minimal Agent Version
columns.deleteColumns synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeReference string mandatory The range reference to specify the columns to focus on. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.

Sample Code:

//delete the columns from H to Z. irpa_excel.worksheet.columns.deleteColumns("H49:Z120");

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Sort Range

Sort a range on a column.


Technical Name Type Minimal Agent Version
dataFx.sortRange synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
column1 string mandatory Name of the first Excel column to perform the sorting.
order1 irpa_excel.enums.XlSortOrder optional xlAscending Indicates the order of the sorting for the parameter column1.
hasHeaders boolean optional true Indicates if the first row of the range contains headers.
column2 string optional Name of the second Excel column to perform the sorting.
order2 irpa_excel.enums.XlSortOrder optional xlAscending Indicates the order of the sorting for the parameter 'column2'.
column3 string optional Name of the third Excel column to perform the sorting.
order3 irpa_excel.enums.XlSortOrder optional xlAscending Indicates the order of the sorting for the parameter 'column3'.

Sample Code:

//sort the range A1:E42 driven by the column C by ascending way . irpa_excel.worksheet.dataFx.sortRange('A1:E42', true, 'C', irpa_excel.enums.XlSortOrder.xlAscending);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
InvalidArgument irpa_core Please check if the sort columns are inside the range and they are Excel column references, not table header names.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Filter Range

Filter a range based on criteria. This activity can be called several times if the filtering has to be performed on several columns (the activity has to be called once by column).


Technical Name Type Minimal Agent Version
dataFx.filterRange synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
filteringColumn string mandatory Name of the table column to perform the filtering.
criteria1 any mandatory First criteria to perform the filtering. Can be a string, a number or an array of string/number.
operator irpa_excel.enums.XlAutoFilterOperator optional xlFilterValues Indicates the operator to perform the filtering.
criteria2 any optional Second criteria to perform the filtering. Can be a string, a number or an array of string/number.

Sample Code:

//filter the range A1:E42 driven by the column C. The content of C has to be higher (or equal) than 250 and less than 500. irpa_excel.worksheet.dataFx.filterRange('A1:E42', 'C', '>=250', enums.XlAutoFilterOperator.xlAnd, '<500');

Sample Code:

//filter the range A1:H300 driven by the column E. The content of E has to be equal to 500. irpa_excel.worksheet.dataFx.filterRange('A1:H300', 'E', '500', enums.XlAutoFilterOperator.xlFilterValues);

Note:

This activity does not support the filtering on date type.

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Clear Filtering

Clear an existing filter on the current worksheet, or display the default filtering if no filter is existing.


Technical Name Type Minimal Agent Version
dataFx.clearFiltering synchronous WIN-2.0.0

Sample Code:

//Clear an existing filtering. irpa_excel.worksheet.dataFx.clearFiltering();

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel Please check if the rangeReference corresponds to a valid range address.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Is Merged Cell

Returns true if the cell is contained in a merged cell.


Technical Name Type Minimal Agent Version
merge.isMerged synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellReference string optional The cell reference to determine the row to focus on: A;8 or 1;8 or A8 for a single cell. If not defined, the active cell will be used.

Output Parameters:

Name Type Description
isMerged boolean True if the container is merged, false otherwise.

Sample Code:

const isMerged = irpa_excel.worksheet.merge.isMerged('B4');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter cellReference is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Get Merged Range Information

Retrieve the merged cells containing the cell reference.


Technical Name Type Minimal Agent Version
merge.getMergedRange synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
cellReference string optional The cell reference to determine the row to focus on: A;8 or 1;8 or A8 for a single cell. If not defined, the active cell will be used.

Output Parameters:

Name Type Description
mergedRangeInformation irpa_excel.rangeInformation Contains the merged range information like the row count, the column count, the cell count, etc.

Sample Code:

const mergedRangeInfo = irpa_excel.worksheet.merge.getMergedRange('B4');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter cellReference is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Merge Cells

Merge the range to a single merged cell.


Technical Name Type Minimal Agent Version
merge.mergeCells synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.
lineMerge boolean optional false Set this parameter to 'True' to merge cells in each row of the specified range as separate merged cells. The default value is 'False'.

Sample Code:

irpa_excel.worksheet.merge.mergeCells('A1:C4');

Sample Code:

irpa_excel.worksheet.merge.mergeCells('A1:C4', true);

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter cellReference is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Unmerge Cells

Separate a merged area into individual cells.


Technical Name Type Minimal Agent Version
merge.unMergeCells synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
rangeDefinition string mandatory The definition of the range of cells. 'A;5;G;67' or '1;5;7;67' or 'A5:G67' for a range. A;8 or 1;8 or A8 for a single cell.

Sample Code:

irpa_excel.worksheet.merge.unMergeCells('A1:C4');

Errors:

Error Class Package Description
SequenceError irpa_core Have you forgotten to open a workbook or activate a worksheet?
InvalidRangeDefinition irpa_excel If the parameter cellReference is invalid or not supported.
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.