How to detect if Excel is Read-Only and Write Range is not possible?

excel

#1

Hi,

When uipath open file on excel in network drive, which is actually opened by someone else, uipath will still open it normally but without poping up the “Read Only” alert dialog.
When trying to write range onto that excel, the robot doesn’t show any error but in fact the data hasn’t inserted into the excel.

Anyone know how can the excel status can be detected, or how to make sure Write Range is done properly or with appropriate alert?

Ben


#2

Any thought??


#3

using kill process activity kill the excel sheet form task manager


#4

You can use close workbook (or) kill process (or) close application to close any existing applications before you perform your task @ben.wong


#5

@ben.wong You can build in a check for it with ‘Element Exists’. As a selector make sure that the ‘Read Only’ part is in the name of the window.

For example, use the following selector: <wnd app=‘excel.exe’ cls=‘XLMAIN’ title=‘Excel Sheet - Read-Only*’ />
‘Element Exists’ will only return ‘true’ if Read-Only is in the name of the file. If it does, you can handle it as you wish.


#6

Appreciated @sreekanth, but my question is how to detect if an excel file is already locked by another user in his/her computer, the method you suggested cannot close Excel in another user’s computer, so won’t work in my case.


#7

Thank you for the idea with element exists.
with this you can run a loop and check every time if the opened excel application scope is read-only, wait some time and check again until the file is writeable again.