title: Reading excel file in Laravel
body: <p>I'm using <a href="http://www.maatwebsite.nl/laravel-excel/docs" rel="noreferrer">Maatwebsite</a>'s library for reading and creating excel file. The creating was easy and somehow intuitive, but when it comes to reading one, I simply can't figure it out.</p>
  
  <p>This is how my excel file looks like:
  <a href="https://i.stack.imgur.com/2YTk4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2YTk4.png" alt="enter image description here"></a></p>
  
  <p>I figured out how to loop through rows, but what confused me that $row in my example is really type of string, so I can't do $row->something;</p>
  
  <p>In my controller I want to read it like this: </p>
  
  <pre><code> Excel::load('storage\\exports\\'. $fName, function($reader) {
      $reader-&gt;each(function($sheet) {
          Log::warning("sheet happens");
  
          // Loop through rows            
          $sheet-&gt;each(function($row) {
              Log::warning($row);
          });
  
      });
  });
  </code></pre>
  
  <p>This gives me output</p>
  
  <pre><code>[2016-01-28 06:42:05] local.WARNING: sheet happens  
  [2016-01-28 06:42:05] local.WARNING:   
  [2016-01-28 06:42:05] local.WARNING:   
  [2016-01-28 06:42:05] local.WARNING:   
  [2016-01-28 06:42:05] local.WARNING:   
  [2016-01-28 06:42:05] local.WARNING:   
  [2016-01-28 06:42:05] local.WARNING:   
  [2016-01-28 06:42:05] local.WARNING: sheet happens  
  [2016-01-28 06:42:05] local.WARNING: ocjena  
  [2016-01-28 06:42:05] local.WARNING: Kolokvijum 1 (%)  
  [2016-01-28 06:42:05] local.WARNING: Kolokvijum 2  
  [2016-01-28 06:42:05] local.WARNING: Kolokvijum 2 (%)  
  [2016-01-28 06:42:05] local.WARNING: Završni ispit (%)  
  [2016-01-28 06:42:05] local.WARNING: Završni ispit  
  </code></pre>
  
  <p>It confused me that output is not in the right order. </p>
  
  <p>It confused me that my row is type of string. Why?</p>
  
  <p>Is it possible to access specific cells like we do in matrix: $table[$row][$column]; ?</p>
  
  <p>If you can't answer my question I would really apreciate if you have any piece of working code since there is not very much docs online.</p>
  
  <p>EDIT: I found out that I have multiple words at my headers, so somehow it all gets mixed up.</p>
  
  <p>EDIT: Cause there is not much docs online I feel like I should share what solved it.</p>
  
  <p>The solution code:</p>
  
  <pre><code>$rows = Excel::load('storage\\exports\\'. $fName)-&gt;get();
  Log::warning($rows);
  </code></pre>
  
  <p>Prints out:</p>
  
  <pre><code>[{"ime_studenta":"andrej","broj_indeksa":4,"kolokvijum_1":4,"kolokvijum_2":4,"zavrsni_ispit":44,"ukupno":4,"ocjena":4},{"ime_studenta":"as","broj_indeksa":342,"kolokvijum_1":123,"kolokvijum_2":57,"zavrsni_ispit":56,"ukupno":5656,"ocjena":56}] 
  </code></pre>