code: private function writeDefinedNameForAutofilter(XMLWriter $objWriter, Worksheet $pSheet, $pSheetId = 0)
      {
          // definedName for autoFilter
          $autoFilterRange = $pSheet->getAutoFilter()->getRange();
          if (!empty($autoFilterRange)) {
              $objWriter->startElement('definedName');
              $objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
              $objWriter->writeAttribute('localSheetId', $pSheetId);
              $objWriter->writeAttribute('hidden', '1');
  
              // Create absolute coordinate and write as raw text
              $range = Coordinate::splitRange($autoFilterRange);
              $range = $range[0];
              //    Strip any worksheet ref so we can make the cell ref absolute
              if (strpos($range[0], '!') !== false) {
                  list($ws, $range[0]) = explode('!', $range[0]);
              }
  
              $range[0] = Coordinate::absoluteCoordinate($range[0]);
              $range[1] = Coordinate::absoluteCoordinate($range[1]);
              $range = implode(':', $range);
  
              $objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range);
  
              $objWriter->endElement();
          }
      }
docs: Write Defined Name for autoFilter.
  
  @param XMLWriter $objWriter XML Writer
  @param Worksheet $pSheet
  @param int $pSheetId