title: How to fix 'Allowed memory size' when exporting large array data using Laravel Excel 2.1?
body: <p>I'm setting up an export feature based on the generated report, and am having problems when inserting large array rows/data to a sheet using <code>Laravel Excel 2.1</code>'s <code>fromArray</code> method. Is there any alternate way to do this to not get 'Allowed memmory size exhausted'?</p>
  
  <p>I already tried <code>array_chunk</code> method but I'm still getting the memory exhaustion error.</p>
  
  <pre><code>$reportData = $this-&gt;report-&gt;run(); // Depending on the filters of the report, it can get upto 20,000 rows.
  $headers = Input::get('selectedcolumns');
  
  $data = [];
  foreach($report['data'] as $value) {
      $row = [];
      foreach($headers as $header) {
          $row[$header['label']] = $value[$header['name']];
      }
      $data[] = $row;
  }
  
  return Excel::create('Excel', function($excel) use($data) {
      $excel-&gt;sheet('Sheet1', function($sheet) use($data) {
          -&gt;sheet-&gt;fromArray($data);
      });
  })-&gt;store('xls', false, true);
  </code></pre>