Excel Encryption for XLS in Java

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

Following example shows how to load encrypted XLS file and how to save workbook as encrypted XLS 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.

XLS file decrypted and encrypted with GemBox.Spreadsheet for Java
Screenshot of XLS 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 the Professional version, put your serial key below.

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

        XlsLoadOptions loadOptions = new XlsLoadOptions();
        ExcelFile workbook = ExcelFile.load("%InputFileName%", loadOptions);

        XlsSaveOptions saveOptions = new XlsSaveOptions();
        workbook.save("XLS Encryption.xls", saveOptions);

See also

Next steps

GemBox.Spreadsheet for Java is a component that enables you to read, write, edit and convert spreadsheet files from your applications using one simple API.

Download Buy