Make excel file read-only

I have an existing excel file. It is a report template.
I need to make changes to the file (by adding details) and need to save the file in read-only mode.

Manually this scan be done while saving the file : Save As → Tools → General → mark the checkbox for Read-only.

But I don’t save the file that way from UiPath. I’m using Workbook Write Range activity to write to file which will save the excel file.
I even checked Excel Application scope activity which has ReadOnly property. But that only opens the workbook in read-only mode and doesn’t save it as read-only.

Please let me know if it can be done anyway other than mimicking the manual steps.

Hi @ShruthiSreedhar as i know it is not possible with current uipath activities.

@kalyanDev Thank you.

I found a workaround.

We can use the Invoke Code activity and use this code:
File.SetAttributes(FilePath, FileAttributes.ReadOnly)

4 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.