Excel not closing in background when automated with SAP

I am automating SAP and downloading excel through UiPath. When the excel is downloaded, it opens and then the robot closes it. But unfortunately the excel which I closed during the process is running in the background. This effects the robot from downloading the excel in the next robot run. When the downloaded excel( previously) is closed in the task manager, then the robot continues the flow and download’s the excel in the second run. I used click, click image, close window, close workbook activities, but of no use. How can I close the excel completely? Can anyone help?

Try to use the Kill Process Activity. You just have to input the ProcessName which will be closed and then the Kill Process Activity kill the process like in the Task Manager

Follow an example to Kill the Excel Process.

closeExcel_Example.xaml (5.4 KB)

Hope It Helps!


Hi @bhargav29494,

If your flow goes in such a way that the excel doesn’t close then you can try the code as shown below:

conditions are:
listprocess.Where(function(x) x.ProcessName.Trim.Contains(“EXCEL”)).Count>1 (or)
listprocess.Where(function(x) x.ProcessName.Trim.Contains(“EXCEL”))=true

and you can loop this condition if you are using multiple excel’s.
Vikas Reddy


Please use

This syntax in the Process name tab in “Kill Process” activity

Vikas Reddy

Hi Vikas

I’m facing the same issue SAP exportation. Excel application is closed once Kill activity has been perfomed the way you propose. However, the problema reminds, as SAP gets blocked until UIPath is closed, as if UIPath does not let SAP use Excel for any reason.

Many thanks

If I run the robot in a debug mode, the problem hasn’t come out and SAP can export the table in an open Excel file, however, when runnig it in a normal way, then it gets stuck. Perhaps exist a way to get SAP tables without having to export them manually or without opening an Excel application, just creating directly the file …

Please, let me know any enhancement or activity to do so

Kind regards


I tried to reproduce saving directly from the transaction but once I save the excel file and closing it, of course you can always use F9 to save it on a diferent way, I save the excel by examinating the popup saying that the export was success and clicking on it, all works like a charm.

can you please share your XAML in case you have not found a solution.

Guess I need extra help, I don’t get how and where to input this “kill process” command. Can someone explain in “old person” terms? (referring to me)

HI @David_m

Please create a new thread and describe your automation challenge.

The topic above is 4 years old and not any more up2date.

Best regards, Lev