code: public function save($pFilename)
      {
          // garbage collect
          $this->spreadsheet->garbageCollect();
  
          $saveDebugLog = Calculation::getInstance($this->spreadsheet)->getDebugLog()->getWriteDebugLog();
          Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog(false);
          $saveArrayReturnType = Calculation::getArrayReturnType();
          Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE);
  
          // Build CSS
          $this->buildCSS(!$this->useInlineCss);
  
          // Open file
          $fileHandle = fopen($pFilename, 'wb+');
          if ($fileHandle === false) {
              throw new WriterException("Could not open file $pFilename for writing.");
          }
  
          // Write headers
          fwrite($fileHandle, $this->generateHTMLHeader(!$this->useInlineCss));
  
          // Write navigation (tabs)
          if ((!$this->isPdf) && ($this->generateSheetNavigationBlock)) {
              fwrite($fileHandle, $this->generateNavigation());
          }
  
          // Write data
          fwrite($fileHandle, $this->generateSheetData());
  
          // Write footer
          fwrite($fileHandle, $this->generateHTMLFooter());
  
          // Close file
          fclose($fileHandle);
  
          Calculation::setArrayReturnType($saveArrayReturnType);
          Calculation::getInstance($this->spreadsheet)->getDebugLog()->setWriteDebugLog($saveDebugLog);
      }
docs: Save Spreadsheet to file.
  
  @param string $pFilename
  
  @throws WriterException