// Create a new workbook Workbook workbook = new Workbook(); // Open an excel file. InputStream fileStream = this.getResourceStream("xlsx/Medical office start-up expenses 1.xlsx"); workbook.open(fileStream); // Specify the name of the user who reserves write permission on this workbook. workbook.getWriteProtection().setWriteReservedBy("Eric"); // Specify this workbook is saved as read-only recommended. // Microsoft Excel displays a message recommending that you open the workbook as read-only. workbook.getWriteProtection().setReadOnlyRecommended(true); // Protects the workbook with a password so that other users cannot accidentally or intentionally edit the data. // The write-protection only happens when you open it with an Excel application. workbook.getWriteProtection().setWritePassword("Y6dh!et5"); // Save to an excel file workbook.save("CreateWriteProtectedWorkbook.xlsx");