Open a password protected Excel file

Hi Everyone,

Require a help in a scenario.

I need to work on a excel file which is password protected file. I want to unprotect it first to read it, thus but I do not want to use Excel application scope password properties for that due to some constraints.

Either options which I am thinking of are VBscript(need one)/macro.

any help would be appreciated.

@supermanPunch @ppr @Srini84 @balupad14 @THIRU_NANI @ashwin.ashok @Gokul001 @nikhil.girish can you guys suggest something

Thanks

Hi @Shikhar_Tandon , Can you check this?

Hi @vkalra,

Thanks for this, I dont want to go with the activity approach as the file I am reading can be greater than 200 mb in such cases the activity will not work.

Thanks!

Hello @Shikhar_Tandon , even if you go by “either options” you still have to pass the credentials to access and process the file. so what is the harm in using the activity to simplify your automation?

Regards
Balram

@Shikhar_Tandon Please refer to the below thread

Hi @balaraman.ramiya,

Actually as the file is very large in cases, I am using UiPathTeam.XLExcel.Activities to access the file but this package does not give flexibility for password compatibility thus i need some Vb or anything by which I can access the file providing the password then will use UiPathTeam.XLExcel.Activities->Read range activity to read the file.

thanks

Hello,

Have you checked this video?

Thanks!
Athira

Hi @athira.somasekharan,

Thanks for this, whereas in this video is referring to protect/unprotect Sheet. My problem is with the file

The file lock is done by File->Info->Protect File.

Thanks

Hi @Shikhar_Tandon

can you try this buddy
and later execute macro from uipath

Hi @nikhil.girish,

Thanks a lot for you inputs!!

Whereas I cannot perform these steps on clients worksheet data :sweat_smile: :sweat_smile:. They will not agree for this

Thanks!

@Shikhar_Tandon

Check below link for your reference

If you can’t use the activities which are available in UiPath then you need to use Invoke Code activity and write your own code

https://social.msdn.microsoft.com/Forums/vstudio/en-US/bab10aee-1878-4b86-a65b-d79b68ff765c/not-able-to-open-protected-excel-file-from-vbnet?forum=vbgeneral

Check above for the code snippet

Hope this may help you

Thanks

Hi @Shikhar_Tandon ,

Could you try the Below Workflow :

Excel_RemovePasswordProtection.xaml (6.8 KB)

It uses Interop.Excel to Remove the Password Protection from the file. You should then be able to use the XLExcel.Activities to read the file.

Let us know if it doesn’t work.

Hi @supermanPunch,

That works perfectly, only one thing as the file is unlocked post reading the file I want to again password protect it. Can you tweak in the above code and help on that as well.

Thanks !!

@Shikhar_Tandon ,

Check the Updated Workflow Below :
Excel_RemovePasswordProtection.xaml (7.6 KB)

1 Like

Thanks ! :+1:

1 Like

Hi @supermanPunch,

Is there any way too to disable the popup(the Automatic update links popup) using interop as while protecting it is appearing in between and as the file is not owned by me i cannot request the owner to disable that.

Thanks!

@Shikhar_Tandon ,

Generally, we would ask you to Open another Topic for this Purpose.

However, I do think there needs to be some Excel Settings that need to Configured for the Popups to be Disabled, as I have experienced as well. But do Check by adding one line in the Invoke Code :
image

If it doesn’t work I would think the only way Might be to change the Excel Settings, maybe create a New Topic, so People Could Suggest Better Solutions :

Yes, I am aware of this. Whereas Thanks !!

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