title: Export mysql table data as xlsx format using phpspreadsheet,can't not importing
body: <p>I used phpspreadsheet to export mysql table data as XLSX format but after exporting when I import the XLSX file its not importing.the exported xlsx file data is ok.If I copy the data in another XLSX file then it works perfectly.
  Thanks in advance!</p>
  <pre><code>&lt;?php
  require 'connect.php';
  require 'vendor/autoload.php';
  
  use PhpOffice\PhpSpreadsheet\Spreadsheet;
  use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
  use PhpOffice\PhpSpreadsheet\IOFactory;
  
  $spreadsheet = new Spreadsheet();
  $sheet = $spreadsheet-&gt;getActiveSheet();
  $sheet-&gt;setCellValue('A1', 'Program');
  $sheet-&gt;setCellValue('B1', 'FormalCode');
  $sheet-&gt;setCellValue('C1', 'Title');
  
  $sql = &quot;select * from class_routine&quot;;
  $result = $conn-&gt;query($sql);
  if($result-&gt;num_rows &gt; 0){
      $n = 1;
      while($row = $result-&gt;fetch_assoc()){
          $rowNum = $n + 1;
          $sheet-&gt;setCellValue('A' .$rowNum, $row['Program']);
          $sheet-&gt;setCellValue('B' .$rowNum, $row['FormalCode']);
          $sheet-&gt;setCellValue('C' .$rowNum, $row['Title']);
  $n++;
          
          
      }
  }
  
  $filename = 'ClassRoutine-template-'.time().'.xlsx';
  // Redirect output to a client's web browser (Xlsx)
  header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  header('Content-Disposition: attachment;filename=&quot;'.$filename.'&quot;');
  header('Cache-Control: max-age=0');
  // If you're serving to IE 9, then the following may be needed
  header('Cache-Control: max-age=1');
   
  // If you're serving to IE over SSL, then the following may be needed
  header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
  header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
  header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
  header('Pragma: public'); // HTTP/1.
  
  $writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
  $writer-&gt;save('php://output');
  </code></pre>
  <p>Full Code Here <a href="https://pastebin.com/imP2QdLm" rel="nofollow noreferrer">https://pastebin.com/imP2QdLm</a></p>
  <p>Giving this warnings when importing the exported xlsx file in import page:</p>
  <blockquote>
  <p>Warning: XMLReader::open(): Empty string supplied as input in C:\xampp\htdocs\corap\vendor\SpreadsheetReader_XLSX.php on line 959</p>
  <p>Warning: XMLReader::read(): Load Data before trying to read in C:\xampp\htdocs\corap\vendor\SpreadsheetReader_XLSX.php on line 995</p>
  <p>Warning: XMLReader::read(): Load Data before trying to read in C:\xampp\htdocs\corap\vendor\SpreadsheetReader_XLSX.php on line 995</p>
  </blockquote>