Close Excel

Closes an Excel file.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

excelClose --file(Excel) [--save(Boolean)] [--notcalculate(Boolean)]

Dependencies

  • To use this command, open an Excel file with the Open Excel file (excelopen) command.

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
File file Required Excel Variable that stores the Excel instance.
Save save Optional Boolean Saves the excel file before closing it.
Not Calculate notcalculate Optional Boolean Enable to not calculate the Excel file formulas before closing it.

Example

The Open Excel File command opens an Excel file and stores it in a variable named "openExcelFile". Then, the Close Excel command saves and closes the file.

defVar --name openExcelFile --type Excel
excelOpen --file "samplefile" openExcelFile=value
excelClose --file ${openExcelFile} --save
//Result: Opens an excel file and saves it before closing it.

Important: To run the sample script, you must create the excel file and enter its file path in the Open Excel File (excelopen) command.

Limitations

The command does not work as intended when working with Excel files containing mathematical operators such as + and *.use Office commands instead of Excel specific commands to handle files that contain mathematical operators.