How to Unprotect an Excel File

I have an excel file which contain some hidden sheets and they are protected.
I have to unhide the sheets than add some data and hide them back.
But I have to hide them using protect workbook option under
Review>Protect workbook after entering password.


How to do it?
Can anyone suggest.
Thanks in advance!!

I have an excel file which contain some hidden sheets and they are protected.
I have to unhide the sheets than add some data and hide them back.
But I have to hide them using protect workbook option under
Review>Protect workbook after entering password


How to do it?
Can anyone suggest.
Thanks in advance!!

@Kunal_Jain - Try using Protect Sheet activity. So that you can protect the required sheets in a workbook.

From Balareva ??
I have tried using Balareva activity But it is not working for me

@Kunal_Jain Can you check below thread which might help you to unhide using VBA and Mark as solution if this helps.
https://forum.uipath.com/t/how-to-unhide-the-excel-sheet/363325

The Solution that you provided is for Hide/Unhide Sheets.
I need it to unprotect the sheet.

@Kunal_Jain
you could do that using below hotkeys

Alt + R = Switches to Review Menu on the ribbon

PS = Unprotect sheet (if sheet’s already locked with a password) or Protect Sheet (if current sheet is still unprotected)

and you can enter password in resulting dialog and click OK to unlock

@Kunal_Jain Please check these activities:

This is for a sheet
I need to unprotect workbook

How do I type the password when excel is not open.
I am using excel application scope and unchecked the visible option so excel won’t open so how do I type the password.

@Kunal_Jain

However if you are using Excel application Scope, you can directly use “Unprotect Sheet” Activity from UiPath.Excel.Activities
image

Hope this helps:)

Mark as solution if this helps.

I have to unprotect workbook not the sheet

Oh, sorry for the confusion. I think for the whole workbook, you need to use a custom activity, or invoke code / VBA, as I believe there’s no official activity for the task.

You could check here for an example how it could be done with Invoke Code: RTG_Protect-and-unprotect-my-Excel-workbook/Continue_Workflows/Process.xaml at main · UiPath-Services/RTG_Protect-and-unprotect-my-Excel-workbook · GitHub - https://github.com/.

@Kunal_Jain For hiding/unhiding the sheets you must use invoke vba activity and you must use protect/unprotect sheet for adding of data.

image

@Kunal_Jain Refer below thread if it helps to unprotect workbook using activity from marketplace

@Kunal_Jain Mark as solution if it helped…to close the loop

Hi @Saikarthik_Gajwel
No it didn’t helped.
Actually I am not getting the solution for it.

@supermanPunch @Gokul001 @ushu @kirankumar.mahanthi1 @Palaniyappan @Sudharsan_Ka @Anil_G
Can anyone help me with the approach?

Hi @Kunal_Jain ,

Could you give us an understanding of whether you’re able to perform the Hide/Unhide sheets and now you are looking for Protect Workbook methods ?

Have you tried the VBA Option for Protecting and Unprotecting the workbooks or are you looking for something else ?

Hi @supermanPunch
I need to unprotect the workbook first and than unhide the sheets.
But I am not able to find a way to do so because I need to go inside the excel and click on protect workbook.


Please find the attached image.
I have tried to pass VBA
but it did not worked.
VBA will also work if it gives the required output.
Can you help me with the approach please?