Password Protect XLSX File using NET REST API

In this basic topic, you’ll learn how to Password Protect XLSX File using NET REST API. We will create an application to encrypt XLSX file using NET Cloud API by adhering to the detailed and lucid steps mentioned in the following section. The generated application can be integrated with any application supporting NET in macOS, Linux, or Windows environments and conversion can be done for free.

Prerequisite

Steps to Encrypt XLSX File using NET Low Code API

  1. Configure the Client ID and Client Secret for the API to encrypt the Workbook with a password using NET REST API
  2. Instantiate the CellsApi class with client credentials to perform password protection of an XLSX file
  3. Specify the source XLSX file names and load the source XLSX using a name and File object in a HashMap
  4. Instantiate the ProtectWorkbookRequest to set the password and other properties
  5. Create an instance of the PostProtectRequest to set the map files and ProtectWorkbookRequest instance
  6. Call the PostProtect request method to encrypt XLSX file using NET low code API
  7. Save the password protected XLSX file/s on the local disk

The above steps enable you to password protect XLSX using NET REST API. We will initiate the implementation with the configuration of the SDK and creating the CellsAPI class instance. We will then access the source XLSX files using a HashMap and instantiate the ProtectWorkbookRequest and PostProtectRequest classes that are further used for setting the password protection for the XLSX files using the PostProtect() method.

Code for Password Protect XLSX using NET REST API

This basic example code enables you password protect XLSX using NET low code API. You need to provide the source XLSX file and a password for the protection along with other optional properties. After creating the Request Message, the PostProtect() performs the protection of the XLSX file and returns a password protected XLSX file that can stored on the disk or inside the database.

We have learned to encrypt Workbook with Password using NET REST API in this article. If you want to perform XLSX to PNG conversion, refer to the article on how to Convert XLSX to PNG with NET REST API.