title: PHP SimpleXLSX parsing file does not return all values unless XLSX file is manually manipulated first
body: <p>I've scoured SO for an answer to this one, but so far haven't been able to find anything that solves the problem.  If anyone can help, it would be greatly appreciated!</p>
  
  <p>Backstory: I am creating an automated process that will download an .xlsx file from an FTP site, load the data into an array, process/calculate certain data in the array, and then create a CSV file from the adjusted array.  This CSV file will then be imported into a third-party system that only accepts CSV or JSON formats.</p>
  
  <p>I'm currently using SimpleXLSX to read the file, because it's the only one out of PHPExcel, SimpleXLSX, Spout, and a few others that I could get working quickly and without issues (until this point).</p>
  
  <p>My problem is that, if I attempt to read the file as it is received, the first row retrieved into the array is completely blank.  I also noticed that the first array field is []:</p>
  
  <pre><code>Array
      (
          [0] =&gt; Array
              (
                  [] =&gt; 
                  [0] =&gt; 
                  [1] =&gt; 
                  [2] =&gt; 
                  [3] =&gt; 
                  [4] =&gt; 
                  [5] =&gt; 
                  [6] =&gt; 
                  [7] =&gt; 
                  [8] =&gt; 
                  [9] =&gt; 
                  [10] =&gt; 
  </code></pre>
  
  <p>The second row only retrieves data that is not text, and that is equal to zero.  Also, that [] field has shifted between the first and second fields:</p>
  
  <pre><code> [1] =&gt; Array
          (
              [0] =&gt; 
              [] =&gt; CAD
              [1] =&gt; 
              [2] =&gt; 
              [3] =&gt; 
              [4] =&gt; 
              [5] =&gt; 
              [6] =&gt; 
              [7] =&gt; 
              [8] =&gt; 
              [9] =&gt; 
              [10] =&gt; 
  </code></pre>
  
  <p>Note: the value in this [] field almost looks like it is rotating through the columns - on one array, it will be the value of the Record Id field, on the next, it will be the CountryCode, etc.</p>
  
  <p>NOW - if I open the file in Excel, delete an empty row at the bottom of the spreadsheet, and save, the xlsx file triples in size (2,327KB to 6,443KB), BUT the data DOES load into the array correctly!</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [0] =&gt; Record Id
              [1] =&gt; Owner Name
              [2] =&gt; Account Name
              [3] =&gt; Numeric Code
              [4] =&gt; Text Code
              [5] =&gt; Record Location
              [6] =&gt; Date Begins
              [7] =&gt; Date Ends
              [8] =&gt; Record Type
              [9] =&gt; Parent Id
              [10] =&gt; Country Code
              [11] =&gt; Supplier Id
              [12] =&gt; Supplier Name
              [13] =&gt; Supplier Category
              [14] =&gt; Supplier Sub Type
              [15] =&gt; Currency
  </code></pre>
  
  <p>The second row also retrieves the values correctly (please note that blanks and zeroes are actual data):</p>
  
  <pre><code>[1] =&gt; Array
      (
          [0] =&gt; 12345
          [1] =&gt; John Smith
          [2] =&gt; ABC Member
          [3] =&gt; 123456
          [4] =&gt; 12345678
          [5] =&gt; Local
          [6] =&gt; 1990-03-01 00:00:00
          [7] =&gt; 1970-01-01 00:00:00
          [8] =&gt; 123 Program
          [9] =&gt; 98765
          [10] =&gt; US
          [11] =&gt; 123
          [12] =&gt; ABC Tools
          [13] =&gt; Manufacturer
          [14] =&gt; XYZ
          [15] =&gt; USD
  </code></pre>
  
  <p>I am sure it has to do with the SimpleXLSX class, but I don't know how I can fix it - I've tried adding additional schemas to the class, as mentioned in a previous post, but that didn't change anything:</p>
  
  <pre><code>const SCHEMA_REL_RELATIONSHIP  =  'http://schemas.openxmlformats.org/package/2006/relationships';
  const SCHEMA_REL_OFFICEDOCUMENT_RELATIONSHIP = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
  const SCHEMA_REL_WORKSHEETRELATION =  'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet';
  </code></pre>
  
  <p>Here is my code that reads the file after it has been brought down to the local drive from the FTP site: 
  (Note: deleting the blank row, saving, and uploading the file to the FTP site, downloading it, and manipulating it works as expected, so I know it's not the FTP causing the problem.)</p>
  
  <p>What can I look for to determine why I can't read this file as it is received?  Because it is meant to be an automated process, I don't want to have to save the file manually.  This process is meant to run daily.</p>
  
  <pre><code>function read_file($filename, $server_file)
  {
  
      //If the file can be read, load the array
      if ( stristr($server_file, '.xlsx'))
      {
         if($file = SimpleXLSX::parse($filename))
         {
              ?&gt;&lt;pre&gt;&lt;?php print_r($file-&gt;rows() ); ?&gt;&lt;/pre&gt; &lt;?php
         }
         else
         {
             echo SimpleXLSX::parse_error();
         }
      }
  }
  </code></pre>
  
  <p>Thanks in advance for any help someone can provide!</p>