title: How can I read excel file in associative array using codeigniter?
body: <p>Here, I m using PHPexcel library to reading the file. My excel File look like </p>
  
  <p><a href="https://i.stack.imgur.com/oJdgv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oJdgv.png" alt="enter image description here"></a></p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>class Home extends CI_Controller {
      public function index() {
          $this-&gt;load-&gt;library('excel');
          $reader = PHPExcel_IOFactory::createReader('Excel2007');
          $reader-&gt;setReadDataOnly(true);
          $file = isset($_FILES["uploadexcel"]['tmp_name']) ? $_FILES["uploadexcel"]['tmp_name'] : '';
          $excel = $reader-&gt;load($file);
          foreach ($excel-&gt;getWorksheetIterator() as $worksheet) {
              $worksheets = $worksheet-&gt;toArray();
          }
          echo '&lt;pre&gt;';print_r($worksheets);
      }
  }
  </code></pre>
  
  <p>when I am uploading excel file my array like:</p>
  
  <pre><code> Array
   (
    [0] =&gt; Array
      (
          [0] =&gt; url
          [1] =&gt; category_1
          [2] =&gt; category_2
          [3] =&gt; language
          [4] =&gt; f_n
          [5] =&gt; publishers
          [6] =&gt; cost
          [7] =&gt; cost_currency
          [8] =&gt; processing_time
          [9] =&gt; example
          [10] =&gt; note
      )
      [1] =&gt; Array
      (
          [0] =&gt; gettingaway.com
          [1] =&gt; 10
          [2] =&gt; 14
          [3] =&gt; GA
          [4] =&gt; nofollow
          [5] =&gt; 2
          [6] =&gt; 1245
          [7] =&gt; 
          [8] =&gt; 12
          [9] =&gt; testing
          [10] =&gt; Testing Value
      )
  
  
   )
  </code></pre>
  
  <p>But, I want the array like :</p>
  
  <pre><code>Array
     (
      [0] =&gt; Array
      (
          [url] =&gt; gettingaway.com
          [category_1] =&gt; 10
          [category_2] =&gt; 14
          [language] =&gt; GA
          [f_n] =&gt; nofollow
          [publishers] =&gt; Cust Angel
          [cost] =&gt; 12
          [cost_currency] =&gt; USD
          [processing_time] =&gt; 12
          [example] =&gt; example
          [note] =&gt; note
      )   
      [1] =&gt; Array
      (
          [url] =&gt; thebusbench.com
          [category_1] =&gt; 5
          [category_2] =&gt; 13
          [language] =&gt; GA
          [f_n] =&gt; nofollow
          [publishers] =&gt; Cust Angel
          [cost] =&gt; 12
          [cost_currency] =&gt; USD
          [processing_time] =&gt; 6
          [example] =&gt; example
          [note] =&gt; note
      )   
      [2] =&gt; Array
      (
          [url] =&gt; travelintelligence.net
          [category_1] =&gt; 6
          [category_2] =&gt; 11
          [language] =&gt; GA
          [f_n] =&gt; nofollow
          [publishers] =&gt; Cust Angel
          [cost] =&gt; 12
          [cost_currency] =&gt; USD
          [processing_time] =&gt; 2
          [example] =&gt; example
          [note] =&gt; note
      )      
   )
  </code></pre>
  
  <p>In above array, my publisher key value is 2. i.e. the Id of publisher into my database. I want this related id publisher name into array. In my database id 2 related publisher name is <strong>Cust Angel</strong>.</p>