Excel Encryption for XLSX in Java

XLSX encryption enables you to securely protect the content of your Excel workbook (XLSX) from unwanted viewers.

Following example shows how to load encrypted XLSX file and how to save workbook as encrypted XLSX file in Java.

Input and output password should be specified in the appropriate text box. If password is empty, file won't be decrypted / encrypted.

XLSX file decrypted and encrypted with GemBox.Spreadsheet for Java
Screenshot of XLSX file decrypted and encrypted with GemBox.Spreadsheet for Java
Upload your file (Drag file here)
import com.gembox.spreadsheet.*;

class Program {

    public static void main(String[] args) throws java.io.IOException {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.setLicense("FREE-LIMITED-KEY");

        String inputPassword = "%InputPassword%";
        String outputPassword = "%OutputPassword%";

        XlsxLoadOptions loadOptions = new XlsxLoadOptions();
        loadOptions.setPassword(inputPassword);
        ExcelFile workbook = ExcelFile.load("%InputFileName%", loadOptions);

        XlsxSaveOptions saveOptions = new XlsxSaveOptions();
        saveOptions.setPassword(outputPassword);
        workbook.save("XLSX Encryption.xlsx", saveOptions);
    }
}

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.


Like it?

Download Buy

If you want to try the GemBox.Spreadsheet for Java yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.