code: public function setCodeName($pValue, $validate = true)
      {
          // Is this a 'rename' or not?
          if ($this->getCodeName() == $pValue) {
              return $this;
          }
  
          if ($validate) {
              $pValue = str_replace(' ', '_', $pValue); //Excel does this automatically without flinching, we are doing the same
  
              // Syntax check
              // throw an exception if not valid
              self::checkSheetCodeName($pValue);
  
              // We use the same code that setTitle to find a valid codeName else not using a space (Excel don't like) but a '_'
  
              if ($this->getParent()) {
                  // Is there already such sheet name?
                  if ($this->getParent()->sheetCodeNameExists($pValue)) {
                      // Use name, but append with lowest possible integer
  
                      if (Shared\StringHelper::countCharacters($pValue) > 29) {
                          $pValue = Shared\StringHelper::substring($pValue, 0, 29);
                      }
                      $i = 1;
                      while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) {
                          ++$i;
                          if ($i == 10) {
                              if (Shared\StringHelper::countCharacters($pValue) > 28) {
                                  $pValue = Shared\StringHelper::substring($pValue, 0, 28);
                              }
                          } elseif ($i == 100) {
                              if (Shared\StringHelper::countCharacters($pValue) > 27) {
                                  $pValue = Shared\StringHelper::substring($pValue, 0, 27);
                              }
                          }
                      }
  
                      $pValue = $pValue . '_' . $i; // ok, we have a valid name
                  }
              }
          }
  
          $this->codeName = $pValue;
  
          return $this;
      }
docs: Define the code name of the sheet.
  
  @param string $pValue Same rule as Title minus space not allowed (but, like Excel, change
  silently space to underscore)
  @param bool $validate False to skip validation of new title. WARNING: This should only be set
  at parse time (by Readers), where titles can be assumed to be valid.
  
  @throws Exception
  
  @return Worksheet