This example makes the active sheet modifiable if the active sheet is un-modifiable.
spreadsheet.getActiveSheet().protect("1234"); if(spreadsheet.getActiveSheet().isProtected()){ spreadsheet.getActiveSheet().unProtect("1234"); }
Related information
unProtect method