title: How to get specific columns in Laravel [Maatwebsite/Laravel-Excel]
body: <p>the file i am importing has thousands of records which is causing my network to get slow. i want to read only those columns that i need, before inserting it into database. When file is processed , it should first search those columns not the whole file, and fetch the rows of those columns </p>
  
  <pre><code>Excel::load($path, function($reader) {
  
  //Getting headers using this
  
  
         $headers = $reader-&gt;first()-&gt;keys()-&gt;toArray();
  
  //This is the array of required columns
  
         $headings = array('registrant_name','registrant_address','registrant_phone','registrant_zip','registrant_email','registrant_country','registrant_state','registrant_city');
  
  
  });
  </code></pre>
  
  <p><strong>Data insertion after file read.</strong></p>
  
  <pre><code> if($data-&gt;count() &gt; 0)
               {
                foreach($data-&gt;toArray() as $value)
                {
                  $insert[] = array(
                   'registrant_name'  =&gt; $value['registrant_name'],
                   'registrant_address'   =&gt; $value['registrant_address'],
                   'registrant_phone'   =&gt; $value['registrant_phone'],
                   'registrant_zip'   =&gt; $value['registrant_zip'],
                   'registrant_email'   =&gt; $value['registrant_email'],
                   'registrant_country'   =&gt; $value['registrant_country'],
                   'registrant_state'   =&gt; $value['registrant_state'],
                   'registrant_city'   =&gt; $value['registrant_city']
  
                  );                
                 }
                }
  
  
        if(!empty($insert))
        {
         DB::table('customers')-&gt;insert($insert);
        }    
  </code></pre>