title: How to export the excel file with laravel?
body: <p>I've tried maatwebsite to excel export data from the database but once downloaded, the file cannot be opened , </p>
  
  <pre><code>    $users = user::select('username', 'email')-&gt;get();
   // work on the export
        Excel::create('users', function($excel) use ($users){
           $excel-&gt;sheet('sheet 1', function($sheet) use ($users)
              {
                  $sheet-&gt;fromArray($users);
              });
          })-&gt;download('xlsx');
  </code></pre>
  
  <p>When the file is open :</p>
  
  <p><a href="https://i.stack.imgur.com/MUmbD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MUmbD.png" alt="enter image description here"></a></p>
  
  <p>please help me :(</p>
  
  <p>Note:
  I've added:</p>
  
  <blockquote>
    <p>Maatwebsite\Excel\ExcelServiceProvider::class,</p>
    
    <p>'Excel'     => Maatwebsite\Excel\Facades\Excel::class,</p>
  </blockquote>