title: Read excel sheet containing merged cells using PHPExcel
body: <p>I want to read an excel sheet completely and using AJAX send each row to another page for processing. So I have used the following code for converting the excel sheet data into JSON array(Reference PHPExcel example provided in Library):</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  set_time_limit(0);
  
  date_default_timezone_set('Asia/Kolkata');
  set_include_path(get_include_path() . PATH_SEPARATOR . 'PHPExcel-1.8/Classes/');
  require_once 'PHPExcel/IOFactory.php';
  
  $inputFileType = PHPExcel_IOFactory::identify($fileLocation);
  $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  $objReader-&gt;setLoadSheetsOnly("SHEETNAME");
  $objPHPExcel = $objReader-&gt;load($fileLocation);
  
  $data = $objPHPExcel-&gt;getActiveSheet()-&gt;toArray(null,true,true,true);
  ?&gt;
  </code></pre>
  
  <p>Here <code>$filelocation</code> is the location of the uploaded file which is to be read for sending the rows individually using AJAX to another page.
  I am using <code>$data</code> in javascript as</p>
  
  <pre><code>DataToBeUploaded=&lt;?php echo json_encode($data);?&gt;;
  </code></pre>
  
  <p>But the excel sheet contains some merged cells so PHPExcel is not able to read the values in these merged cells. Hence values in these cells are read as NULL. </p>
  
  <p>Is there a way where I can use the merged cells' upper left cell value for all of the subsequent cells? (Actually in my case cells are merged vertically only)</p>
  
  <p>Eg.
  I have (Assume rows are numbered from 1 and columns from A)</p>
  
  <p><a href="https://i.stack.imgur.com/JIlPx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JIlPx.png" alt="merged cells excel sheet example"></a></p>
  
  <p>Here PHPExcel reads this as:</p>
  
  <pre><code>data[1][A]='abc'
  $data[1][B]='123'
  
  $data[2][A]=''
  $data[2][B]='456'
  
  $data[3][A]=''
  $data[3][B]='789'
  </code></pre>
  
  <p>I want the snippet to result in these values:</p>
  
  <pre><code>data[1][A]='abc'
  $data[1][B]='123'
  
  $data[2][A]='abc'
  $data[2][B]='456'
  
  $data[3][A]='abc'
  $data[3][B]='789'
  </code></pre>