Opens an Excel workbook and provides a scope for Excel Activities. When the execution of this activity ends, the specified workbook and the Excel application are closed. If a
WorkbookApplication variable is provided in the Output > Workbook property field, the spreadsheet is not closed after the activity ends. If the specified file does not exist, a new Excel file is created. This activity can only be used if the Microsoft Excel application is installed on your machine.
Strings must be placed between quotation marks.
- DisplayName - The display name of the activity.
- Edit password - The password required for editing password protected Excel workbooks, if necessary. Only String variables and strings are supported.
- Password - The password required for opening password protected Excel workbooks, if necessary. Only String variables and strings are supported.
- Workbook path - The full path of the Excel spreadsheet that you want to use. If the Excel file to be used is located in the project folder, its relative path can be used. Only String variables and strings are supported.
- Private - If selected, the values of variables and arguments are no longer logged at Verbose level.
- Create if not exists - When selected, if the workbook cannot be found at the specified path, a new Excel workbook is created with the name specified in the Workbook path property field. When cleared, if the workbook cannot be found at the specified path, an exception is thrown, informing the user. By default, this checkbox is selected.
- InstanceCachePeriod - How long to keep the Excel process alive after all child activities are executed. The default value is 3,000 ms. When the activity is used inside a loop (for example, in a For Each activity) or when multiple Excel Application Scope activities are used consecutively, this prevents errors that can be caused by the Excel process shutting down while opening the next file. To shut Excel down as fast as possible, set the value to 0.
When working with multiple files, leaving UiPath to manage the lifetime of the Excel process creates the possibility of this "race condition" to cause an error. To prevent this, we recommend creating a parent Excel Application Scope activity, saving the output Workbook as a variable, placing all other Excel Application Scope activities inside this parent, and reusing the WorkbookApplication variable as the input for the ExistingWorkbook property in all child scope activities. This ensures Excel remains running for as long as the automation is using Excel.
- MacroSetting - Specifies the macro level for the current Excel file. By default, EnableAll is selected. The drop-down contains three options, as follows:
- EnableAll - All macros are enabled and can be run.
- DisableAll - All macros are disabled in the specified Excel file. No macros can be run.
- ReadFromExcelSettings - Reads the current Excel Macro settings.
- Read-only - Opens the specified workbook in Read-Only mode. Selecting this check box enables you to perform data extraction operations in an Excel file which is locked for editing or has an edit password. By default, this check box is not selected.
- Save changes - Automatically saves the workbook on each change caused by an activity. If disabled, the changes will not be saved when the execution of the Excel Application Scope ends. By default, this checkbox is selected.
- Visible - When selected, the Excel file is opened in the foreground while performing actions on it. When it is cleared, all operations are done in the background.
- Workbook - The entire information from the Excel spreadsheet stored in a WorkbookApplication variable. This variable can be used in another Excel Application Scope activity. Only WorkbookApplication variables are supported.
- ExistingWorkbook - Use the data from an Excel file that was previously stored in a WorkbookApplication variable. Only WorkbookApplication variables are supported.
To exemplify how to use this activity, we have built an automation project which includes an Excel Application Scope activity among other activities. You can download the workflow here.
Updated 11 months ago