code: private function writeSheetProtection()
      {
          // record identifier
          $record = 0x0867;
  
          // prepare options
          $options = (int) !$this->phpSheet->getProtection()->getObjects()
                      | (int) !$this->phpSheet->getProtection()->getScenarios() << 1
                      | (int) !$this->phpSheet->getProtection()->getFormatCells() << 2
                      | (int) !$this->phpSheet->getProtection()->getFormatColumns() << 3
                      | (int) !$this->phpSheet->getProtection()->getFormatRows() << 4
                      | (int) !$this->phpSheet->getProtection()->getInsertColumns() << 5
                      | (int) !$this->phpSheet->getProtection()->getInsertRows() << 6
                      | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks() << 7
                      | (int) !$this->phpSheet->getProtection()->getDeleteColumns() << 8
                      | (int) !$this->phpSheet->getProtection()->getDeleteRows() << 9
                      | (int) !$this->phpSheet->getProtection()->getSelectLockedCells() << 10
                      | (int) !$this->phpSheet->getProtection()->getSort() << 11
                      | (int) !$this->phpSheet->getProtection()->getAutoFilter() << 12
                      | (int) !$this->phpSheet->getProtection()->getPivotTables() << 13
                      | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14;
  
          // record data
          $recordData = pack(
              'vVVCVVvv',
              0x0867, // repeated record identifier
              0x0000, // not used
              0x0000, // not used
              0x00, // not used
              0x01000200, // unknown data
              0xFFFFFFFF, // unknown data
              $options, // options
              0x0000 // not used
          );
  
          $length = strlen($recordData);
          $header = pack('vv', $record, $length);
  
          $this->append($header . $recordData);
      }
docs: Write SHEETPROTECTION.