Can I set a password against the excel I download to protect the sheet from people modifying it?
Can I set a password against the excel I download to protect the sheet from people modifying it?
manpat
Posts: 4Questions: 1Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
This discussion has been closed.
Answers
You would need to manipulate the XML. You can do that using jQuery but it is very cumbersome.
Here is an example of such a manipulation: https://datatables.net/forums/discussion/comment/146854/#Comment_146854
You'll find more in the forum. But I am not sure whether you'll find any example on how to password protect the file.
Here is the documentation:
https://datatables.net/reference/button/excelHtml5
It has links to the Open XML and the Microsoft documentation.
Here is a link on how to password protect a file using Open XML:
https://stackoverflow.com/questions/39449653/how-to-password-protect-an-excel-document-with-open-xml
In this case the manipulation is done using C#. But you should be able to do this with Javascript / jQuery as well, I guess.
Here is an example doing it with Javascript / TypeScript - from the Microsoft docs:
https://docs.microsoft.com/en-us/javascript/api/excel/excel.workbookprotection?view=excel-js-preview&viewFallbackFrom=office-js#protect-password-
Good luck!
Thanks for the response. I will give this a try and confirm what worked for me.