Encrypt Excel File with Password (Add password to excel file)

Hallo,

i’ve search for any method to encrypt our excel with password (add password to our exsiting file), i mean not just protect sheet or workbook, but all the file. For comparison, if u do it in excel manually you can go through this = Info>Protect Workbook>Encrypt with Password

Please help if anyone know how to do it in UiPath, whether use vba code or use any activities . Thx

Hi @llayla

Check out these package from marketplace

This package contains the activities to protect the excel file and word file.

Hope it helps.

Hi @llayla

Check on this thread

Regards,

Hi IIayla,

You can go through the below steps to protect all the sheets in an excel file.

Regards,
Vidya

Hi @llayla

You can encrypt the whole excel file by using the VBA code.

  • Take one Excel process scope
  • Place the Use excel file activity inside the Excel process scope.
  • Give the path of the file in the use excel file activity.
  • Inside the Use excel file activity drag and drop the Invoke VBA activity.

Store the below expression in a notepad and save it as a document and copy the path

Sub EncryptWorkbook()
    ActiveWorkbook.Password = "YourPassword"
End Sub

  • In invoke VBA activity
    → In target workbook option give the “Excel” that was in the use excel file reference.
    → In Code file path pass the notepad path.
    → In Entry Method name give the name as “EncryptWorkbook”

It was the encrypting the whole excel file. It works

Hope it helps!!

1 Like

Thanks guys for the answer, finaly i use balareva dependencies with “Set Password” activity. :+1: :+1:

Hi, thanks for sharing,
however, whatever the password that we were using i need to share with user over the email, how to i get the password from vba script to studio.?