// 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); //Protects the workbook with a password so that other users cannot view hidden worksheets, add, move, delete, hide, or rename worksheets. //The protection only happens when you open it with an Excel application. workbook.protect("Y6dh!et5"); // Save to an excel file workbook.save("ProtectWorkbook.xlsx");
// Create a new workbook var workbook = Workbook() // Open an excel file val fileStream = this.getResourceStream("xlsx/Medical office start-up expenses 1.xlsx") workbook.open(fileStream) //Protects the workbook with a password so that other users cannot view hidden worksheets, add, move, delete, hide, or rename worksheets. //The protection only happens when you open it with an Excel application. workbook.protect("Y6dh!et5") // Save to an excel file workbook.save("ProtectWorkbook.xlsx")