
Decrypt or Encrypt Excel Files using Node.js
Do you need to protect your Excel files from unauthorized changes? This post shows how to decrypt or encrypt Excel files using Node.js. Automating file security improves efficiency and data integrity. The Node.js Excel library provides features for this automation and can be integrated into any Node.js application.
The following sections shall be covered in this article:
- Decrypt or Encrypt Excel Files using Node.js - API installation
- How to Encrypt Excel File programmatically
- Node.js library to Decrypt an Excel File
Decrypt or Encrypt Excel Files using Node.js - API installation
Node.js Excel library offers a wide range of file manipulation and conversion features. Users can find complete documentation along with examples and descriptions. It is quite easy to install and simple to use.
Run the following commands to set up this library in your project:
npm install java
npm install aspose.cells
How to Encrypt Excel File programmatically
Adding a password to an Excel file programmatically is now simple and reliable. You can also choose encryption type and strength using this Node.js Excel library.
Follow these steps and the code snippet to encrypt an Excel file with Node.js:
- Fetch the aspose.cells module into your Node.js project.
- Initialize an instance of the Workbook class.
- Access the Workbook settings by calling the getSettings() method and set the password with setPassword(string).
- Call the setEncryptionOptions method to define the encryption type.
- Use save(fileName, saveFormat) to save the encrypted file.
Node.js library to Decrypt an Excel File
Follow these steps and the code snippet to decrypt an encrypted Excel file programmatically:
- Instantiate a LoadOptions object to access XLSX file options.
- Provide the correct password using the setPassword(string) method.
- Create a Workbook instance and load the encrypted file with the LoadOptions object.
- Reset the password to NULL by invoking setPassword().
- Call save(fileName, saveFormat) to save the decrypted file.
Get a Free License
You can avail a free temporary license to try the API without evaluation limitations.
Summing up
We hope you now know how to decrypt or encrypt Excel files using Node.js. The code snippets and library links provide a full list of methods. Explore the related links in the See Also section, and visit conholdate.com for more blog posts. Stay tuned for updates.
Ask a question
You may share your questions or queries on our forum.