How can I add password to excel?
Question

Hi im using this plugin

https://www.outsystems.com/forge/Component_Documentation.aspx?ProjectId=1044&ProjectName=excel-package


anyone knows how can I use the worksheet_protect? 

I tried it on my preparation on my sending email but it won't work.

What I wanted to do is, when the user received the email, I want the excel attachment protected with password before they can see the data.

Untitled.png

Solution

I see why, please use Workbook_Protect instead of Worksheet_Protect and it will resolve the issue

Hello Ruru,

Please confirm:

Is the problem that the file gets emailed but when you open the attachment, it is not password protected anymore? 

If you disable the email feature and download the file after the password protect action is it password protected?

Regards,

AJ

actually having some error, 

Error creating Email. Unable to cast object of type 'OfficeOpenXml.ExcelPackage' to type 'OfficeOpenXml.ExcelWorksheet'.


- because of the error above, I can't send the email with attachment.


Am I doing it right?

Please the attached image, this is how I did it.

Sorry I dont have idea how to use this worksheet_protect.

Untitled.png

Solution

I see why, please use Workbook_Protect instead of Worksheet_Protect and it will resolve the issue

Please make sure that 'Workbook_Protect' is checked under "Manage Dependencies":


Yep, I did looked on the dependencies to double check, maybe mine not updated? 


Interesting because the last time this particular package was published was June 17, 2020 and if you downloaded after that you would have the latest and greatest. 

Option 1 - Delete Excel_Package and try to download it afresh and see if that works out.

Option 2 - Delete Excel_Package and install Advanced_Excel instead (I would not keep both of them as it can lead to unpredictable behavior at least in my experience). Advanced Excel has the Workbook_Protect feature.

Regards,

AJ

will do , thanks Aj for your response, big help!

Hello Ruru,

if you are using advance Excel,

Then may be this thread will solved your problem already mark as solution please go through this once

for help

https://www.outsystems.com/forums/discussion/51449/generating-a-password-protected-workbook/

Thanks and Regards,
Akshay Deshpande
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.