Close only the specific excel file

Hello,

I have an automation that generates a CSV file. In some cases, the generated CSV file may already be opened in Excel together with other Excel files.

I only want to force close the specific generated CSV file without affecting the other opened Excel files. Using the Kill Process activity is not an option because it closes all active Excel files.

Is there a way to close only the specific Excel/CSV file that is being used by the automation?

Thank you.

Hi @chavezneilb ,

Please find the attached threads for your reference

Hope it helps!!

Hey @chavezneilb,

Please use the “Close Workbook” activity instead of the “Kill Process” method. Here are the steps to follow:

  1. Use the “Excel Application Scope” activity.
  2. Inside the scope, add the “Close Workbook” activity.
  3. Specify the file path of your CSV file.
  4. If needed, check the “Save” option.

This will close only the specified workbook, leaving Excel itself open.

Hi @chavezneilb

please try this below approach:
If the CSV is opened through the automation, use:

  1. Use Excel File / Excel Application Scope
    2 Then use Close Workbook activity for that specific file.

If the file is already opened manually, you can:

1 Use Get Workbook/Window
2 Identify the workbook by file name
3 Close only that workbook instead of killing EXCEL.EXE

If Solution works for you please mark as Solution & Happy Automation with UiPath

Thanks
Nishi