Do you consider using Excel Application Scope Workbook Output with Close Workbook activity a good practice?

Hi All,

Do you consider using Excel Application Scope Workbook Output with Close Workbook activity a good practice?
Are aware of any risks of not using Close Workbook activity?
Do you think the lack of the Close Workbook might cause a potential HRESULT exception assuming there will be some excel instance left?

Please let me know what are your thoughts and how do you work with Excel.
I will be grateful for your insights.

Best,
Roxy

1 Like

Hi @RoxyPieZu

Welcome to uipath community

No buddy
Not really
It’s not required to close the file immediately once it is opened with excel application scope
Because by default it will close the file once the data in it is obtained

And if you go by REFramework by default we will be having KILL PROCESS at the END STATE which willl eventually close all the application used in process that includes excel as well

Only if the same excel once after being read is used immediately to write back then it is essentially to kill or close the application

And in order to avoid such scenario or the exception you mentioned, while writing alone use WORKBOOK activities like write range activity because it will not require excel application to be triggered

Cheers

1 Like

Hi @Palaniyappan

many thanks for such a quick response.

Follow-up question:

Did you mean that it makes sense to use Close Workbook activity/Kill Process in case of a need to play with the same Excel file multiple times in a row? Do you know the reason behind this?

Cheers

1 Like

@RoxyPieZu

Setting Cache instance period to 0 is also useful to avoid HRESULT error.

1 Like

Ofcourse
If you are using a excel file repeatedly for multiple tikes one after the another then we will be getting issue in excel service
Or sometimes it will throw an error that excel file is being used by another process
Or HRResult call error

@RoxyPieZu

1 Like