How to save an excel Read-only file to edit it

I would like to save an excel read-only file option to edit it.
Are there any better ways to do that other than keep clicking buttons?
Thank you!

1 Like

@Kunal_Jain

I guess this is what you need

Cheers

1 Like

I have a read only file
I want to convert that file to writable form

1 Like

@Kunal_Jain

Is it locked?

Cheers

1 Like

Yes it is locked and we have to edit it

1 Like

@Kunal_Jain

Try this in invoke code

Cheers

1 Like

image
I am getting this error

1 Like

Hi @Kunal_Jain
Please find the solution in below

To do this in UiPath, you can use the Copy File activity and specify the source and destination paths for the copy of the file. Then, you can use the Write Range activity to edit the copied file, and the Save Workbook activity to save your changes.

1 Like

Is there any script which we can use in invoke code.

1 Like

Hi @Kunal_Jain
If you want an code means please check in below

Declare variables to hold the path of the read-only file and the new file name and path.
Dim readOnlyFilePath, newFilePath

Set the variables to the actual path of the read-only file and the new file name and path.
readOnlyFilePath = “C:\MyFiles\ReadOnly.xlsx”
newFilePath = “C:\MyFiles\Editable.xlsx”

Open the Excel application and the read-only file.
Set excelApp = CreateObject(“Excel.Application”)
Set workbook = excelApp.Workbooks.Open(readOnlyFilePath)

Save the file as a writable file using the SaveAs method.
workbook.SaveAs newFilePath

Close the Excel application and release the objects from memory.
workbook.Close
excelApp.Quit
Set excelApp = Nothing
Set workbook = Nothing

1 Like

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