How to avoid readonly excel file error while updating data

While using write cell inside excel application scope. i am getting below error:
“File ABC.xlsx is read only and can not be overwritten. It has been saved as file ABC.xlsx at Source:”
Some times.
how to resolve this?

2 Likes

@rsahu Have you checked Read Only in the Properties Panel of Excel Application Scope ?

1 Like

no. How it will help?
i am guessing if check it, i can’t write cell or update any data.

@rsahu Yes.

Ok thanks. but in my excel application scope. read only is unchecked. still i am getting this issue some time.

@rsahu As a best practice use Kill Process Activity Before you use Excel Scope and another Kill Process After you use Excel Scope and Check if it works.

If Problem still Exists, then it would mean the file maybe set to read only. Also Check Auto Save Option. Or Only use Auto Save Option and let other options be unchecked when you are modifying the file.

Hi rsahu. Can you solve this problem ? I have the similar problem too.

+1 with the same issue.

Hi Rsahu,

there is a package called BalaReva.FileProperties.Activities. This package includes activities with which you can change all file properties. Leave Readonly activity unchecked to remove readonly property. At the end of your workflow use the activity again but this time with readonly checked to reset readonly.
If it helped you solve your problem, mark this as solution.

thanks
B.D

@FranciscoAraujo
@Volkan_Onat

I had the same problem. I just changed the security of Excel properties and make sure “modify” is clicked. it’s work for me.

image

1 Like

Something to try, change the property “visible” to false, under your excel application scope. It worked for me

I found 2 Solution

Note: use this solution before reading excel file

Solution 1: Use Invoke Power Shell Activity - use Below Command (enable isScript =“TRUE” )
“Set-ItemProperty ‘Use Full excel Path here’ -name:IsReadOnly -value:0”
Below Screenshot is for solution 1:

Solution 2:use Invoke Method
1 : Target Type : System.io.File
2: MethodName: SetAttributes
3: Parameter:
in String (excel File Path)
in FileAttributes - FileAttributes.Normal
Below screenshot is for reference :

Please Mark it as Solutions…
Cheers,

Regards,
Ravi Gupta.

1 Like

It will work even if the user that will execute the robot is not a system administrator user in the company?
Note that the file that my robot needs to work with is stored in Sharepoint, I’m giving the Sharepoint path to the robot.