Learn how to encrypt and decrypt Excel fils in Node.js: https://blog.aspose.com/2021/10/14/encrypt-or-decrypt-excel-files-in-node-js/
Last active
October 15, 2021 03:45
-
-
Save aspose-com-gists/51e7785a67fa69c534d76021f2b70a1a to your computer and use it in GitHub Desktop.
Encrypt Decrypt Excel Files in Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize loading options | |
var loadOptions = new aspose.cells.LoadOptions(LoadFormat.XLSX); | |
// Set original password | |
loadOptions.setPassword("1234"); | |
// Instantiate a Workbook object with Excel file's path | |
var workbook = new aspose.cells.Workbook("encrypted-workbook.xlsx", loadOptions); | |
// Set password to null | |
workbook.getSettings().setPassword(null); | |
// Save the file | |
workbook.save("decrypted.xlsx"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open the Excel file | |
var workbook = new aspose.cells.Workbook("Excel.xlsx"); | |
// Password protect the file | |
workbook.getSettings().setPassword("1234"); | |
// Specify Strong Encryption type (RC4, Microsoft Strong Cryptographic Provider) | |
workbook.setEncryptionOptions(aspose.cells.EncryptionType.STRONG_CRYPTOGRAPHIC_PROVIDER, 128); | |
// Save the file | |
workbook.save("encrypted.xlsx"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment