title: Creating Excel file using PhpSpreadsheet with default data using Laravel 5.5
body: <p>I am trying to download excel file with pre-populated data using PhpSpreadsheet in laravel. But I am got empty file downloaded.Here`s my code.</p>
  
  <pre><code>use PhpOffice\PhpSpreadsheet\Spreadsheet;
  use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
  
  $spreadsheet = new Spreadsheet();
  $sheet = $spreadsheet-&gt;getActiveSheet();
  $sheet-&gt;setCellValue('B1','testing');
  
  $writer = new Xlsx($spreadsheet);
  $filename = 'tessa';
  
  header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
  header('Content-Disposition: attachment;filename="'. $filename .'.Xlsx"');
  header('Cache-Control: max-age=0');
  
  $writer-&gt;save($filename);
  </code></pre>
  
  <p>I tried dd($sheet)  Here how it looks,it contains my data;</p>
  
  <p><a href="https://i.stack.imgur.com/y3ThN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y3ThN.png" alt="enter image description here"></a></p>
  
  <p>The file downloaded but empty file.Can any one tell me how to solve the issue? </p>