Skip to main content

Close Excel

Sophie avatar
Written by Sophie
Updated over a week ago

Definition and Usage

Close Excel allows you to close a specified Excel file or all open Excel files. This command provides options to save changes before closing, save to a new location, or close without saving changes. It supports both Microsoft Office Excel and WPS Excel applications.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Close

Select whether to close a specific Excel file or all open files

A specified Excel file, All Excel files

Yes

Excel instance

Please select an Excel instance (created via the "Launch Excel" or "Get active Excel worksheet" command) to identify the instance to operate on

Required when closing a specified file

Save mode

Choose whether to save, save as a new file, or discard changes before closing

Save, Save as, Don't save

Yes

Save file path

Enter the full path or select a location to save the Excel file

Required when "Save as" is selected

Overwrite if exists

Select to overwrite the file if one with the same name exists. An error will occur if not selected

Optional

Excel app

Select the application to close all open files

Office, WPS

Required when closing all Excel files

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action doesn't produce any variables.


Using Variables in Conditions

You can use variables in parameters such as "Excel instance" and "Save file path" by clicking on the variable icon or typing "{}" to insert previously created variables. This is particularly useful when you need to dynamically specify file paths or reference Excel instances created earlier in your workflow.


Notes

  • Before using this command, ensure that the Excel instance you want to close has been properly initialized through "Launch Excel" or "Get active Excel worksheet" commands.

  • When using "Save as" option, make sure the specified directory exists and you have proper write permissions.

  • If "Overwrite if exists" is not selected and a file with the same name already exists at the specified location, the command will generate an error.

  • When closing all Excel files, ensure that unsaved work in other Excel instances won't be lost unexpectedly.

Did this answer your question?