Setting password on excel file through uipath studio

Hi i have a case I want to copy and paste one template to other place and then write data in that pasted excel file and then before sending it in mail i want to put password on that file through our UiPath studio activities

HI @ashish_negi, Please check this post UiPathGo - BalaReva Excel Activities - Help / Marketplace - UiPath Community Forum

there is an activity called “SetPassword” that can be used to set a password for the Excel file.

Or

Use invoke VBA
check this : (5) How to protect and unprotect excel worksheet using UiPath Studio | RPA LEARNERS | INVOKE VBA - YouTube

Hi @Rahul_Rajendran ,

I can only use UiPath packages and in vba video it is protecting the sheet i want to put password without it i cannot open my excel file

Hi @ashish_negi

Try to use the “Excel Process Scope” or **“Excel Application Scope” add the “Protect Workbook” activity and enter your desired password.

Check below link

If you found helpful mark as solution.
Happy Automation

Hello @ashish_negi,

This is how you can protect the workbook by invoking the VBA-

Here is VBA code with input parameter password

Sub SetWorkbookPassword(ByVal pass As String)
        Dim strPassword As String
        strPassword = pass 
        ActiveWorkbook.Password = strPassword
End Sub

Hope it helps, mark as solution if it works.

Hi, in this when i am puting numbers as password it is working but when i am puting password like UiPath@123 its not working when i an puting alphabets in it

Hello @ashish_negi, What’s the error?
I have tested with UiPath@123, it is working for me.