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

Module - Application

Collection of functions based on the MS Excel application.

Activities

Open Excel Instance

MANDATORY activity to drop when using MS Excel: opens an instance of MS Excel. Once you open an Excel instance, you can use other MS Excel activities.


Technical Name Type Minimal Agent Version
newExcelInstance synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
visible boolean optional true Excel is opened in visible mode if set to true. Excel is opened in hidden mode if set to false.
displayAlerts boolean optional false If set to false, prompts and alerting messages won't be displayed. In this case Microsoft Excel chooses a default response in case of message requiring a response.

Sample Code:

//Start a new Excel Instance and we are ready to work with it irpa_excel.application.newExcelInstance();

Note:

This is mandatory to call this activity to work with irpa_excel. This activity must be the first one used about irpa_excel.



Get Open Workbook List

Retrieve the list of open workbooks from Running Object Table (ROT).


Technical Name Type Minimal Agent Version
getOpenWorkbookList synchronous WIN-2.0.31, WIN-3.9

Output Parameters:

Name Type Description
workbookList Array. The list of open workbook identifiers.

Sample Code:

irpa_excel.application.getOpenWorkbookList();



Get Excel Instance

Retrieve an already opened instance of MS Excel.


Technical Name Type Minimal Agent Version
getExcelInstance synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
workbookIdentifier string mandatory Workbook Identifier. If the workbook has not been saved yet, the identifier is the name displayed in the header of Excel. If the workbook has been saved, or open from a file, the identifier is the full path of the workbook.

Sample Code:

//Get an instance of a new workbook that has not been saved : irpa_excel.application.getExcelInstance("Book1");

Sample Code:

//Get an instance of a workbook that has been manually opened from a file or that has been saved : irpa_excel.application.getExcelInstance("C:\\temp\\workbookFile.xlsx");

Errors:

Error Class Package Description
EditModeError irpa_excel Excel is in edit mode and cannot be automated. Please leave the edit mode manually.


Close Excel Instance

Close an instance of MS Excel. Once closed, you need to open a new Excel instance to use other MS Excel activities.


Technical Name Type Minimal Agent Version
closeExcel synchronous WIN-2.0.0

Sample Code:

//Close the Excel instance and we release the technical objects irpa_excel.application.closeExcel();

Note:

There is no need to use this activity if the "Release Excel Instance" activity is used instead.

Note:

This activity must be used in an automation when "Open Excel Instance" has been used (except if "Release Excel Instance" is used).

Note:

No irpa_excel activities should be executed after the call to this activity.

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.


Release Excel Instance

Release an instance of MS Excel without closing the file or the application. Open Excel Instance activity is required to launch other activities.


Technical Name Type Minimal Agent Version
release synchronous WIN-2.0.0

Sample Code:

//Release the technical objects about the Excel instance. irpa_excel.application.release();

Note:

There is no need to use this activity if the "Close Excel Instance" activity is used instead.

Note:

This activity must be used in an automation when "Open Excel Instance" has been used (except if "Close Excel Instance" is used).

Note:

No irpa_excel activities should be executed after the call to this activity.

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.


List Add-Ins

List available Add-Ins.


Technical Name Type Minimal Agent Version
listAddIns synchronous WIN-2.0.0

Output Parameters:

Name Type Description
AddInList Array.<irpa_excel.addInDescription> List of available Add-Ins.

Sample Code:

irpa_excel.application.listAddIns();

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.


Register & Install Excel Add-In

Register and install an Excel Add-In from Excel's Add-Ins list.


Technical Name Type Minimal Agent Version
regInstallAddIn synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
addInName string mandatory Name of the Add-In, retrieved from the 'List Add-Ins' activity.

Sample Code:

irpa_excel.application.regInstallAddIn('addInName');

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.
NotFound irpa_core Add-In could not be found.


Uninstall Excel Add-In

Uninstall an Excel Add-In from Excel's Add-Ins list.


Technical Name Type Minimal Agent Version
unInstallAddIn synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
addInName string mandatory Name of the Add-In, retrieved from the 'List Add-Ins' activity.

Sample Code:

irpa_excel.application.unInstallAddIn('addInName');

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.
NotFound irpa_core Add-In could not be found.


List COM Add-Ins

List available COM Add-Ins.


Technical Name Type Minimal Agent Version
listCOMAddIns synchronous WIN-2.0.0

Output Parameters:

Name Type Description
COMAddInList Array.<irpa_excel.COMAddInDescription> List of available COM Add-Ins.

Sample Code:

irpa_excel.application.listCOMAddIns();

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.


Connect Excel COM Add-In

Connect Excel COM Add-In from Excel's COM Add-Ins list.


Technical Name Type Minimal Agent Version
connectCOMAddIn synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
progId string mandatory ProgId of the COM Add-In, retrieved from the 'List COM Add-Ins' activity.

Sample Code:

irpa_excel.application.connectCOMAddIn('progId');

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.
NotFound irpa_core COM Add-In could not be found.


Disconnect Excel COM Add-In

Disconnect Excel COM Add-In from Excel's COM Add-Ins list.


Technical Name Type Minimal Agent Version
disconnectCOMAddIn synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
progId string mandatory ProgId of the COM Add-In, retrieved from the 'List COM Add-Ins' activity.

Sample Code:

irpa_excel.application.disconnectCOMAddIn('progId');

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.
NotFound irpa_core COM Add-In could not be found.


Trigger Macro

Trigger a macro.


Technical Name Type Minimal Agent Version
triggerMacro synchronous WIN-2.0.0

Input Parameters:

Name Type Attributes Default Description
macroName string mandatory The name of the macro to execute.
workbookName string optional The name of the workbook containing the macro.

Output Parameters:

Name Type Description
macroResult any The result of the macro.

Sample Code:

//Run the macro named myMacroName found in any workbook. const myWorkbookName = irpa_excel.application.triggerMacro('myMacroName');

Sample Code:

//Run the macro named myMacroName found in a workbook named myWorkbookName. const myWorkbookName = irpa_excel.application.triggerMacro('myMacroName', 'myWorkbookName');

Sample Code:

//Run the macro named myMacroName found in a workbook named myWorkbookName. const myWorkbookName = irpa_excel.application.triggerMacro('myWorkbookName!myMacroName');

Errors:

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


Get Active Workbook Name

Retrieve the name of the active workbook.


Technical Name Type Minimal Agent Version
getActiveWorkbookName synchronous WIN-2.0.0

Output Parameters:

Name Type Description
activeWorkbookName string The name of the active workbook.

Sample Code:

//Get the name of the active workbook. const myWorkbookName = irpa_excel.application.getActiveWorkbookName();

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 Workbook Names

Retrieve the names of the opened workbooks in the current Microsoft Excel instance.


Technical Name Type Minimal Agent Version
getWorkbookNames synchronous WIN-2.0.0

Output Parameters:

Name Type Description
workbookNames Array. The names of the opened workbook.

Sample Code:

//Get the names of the opened workbooks of the current application. const workbookNames = irpa_excel.application.getWorkbookNames();

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.