title: PHPExcel: Invalid cell coordinate A when inserting Excel into SQL database
body: <p>In PHP, I am looping through an excel file and inserting it into an MSSQL database. I am getting this error:</p>
  
  <p>Uncaught exception 'PHPExcel_Exception' with message 'Invalid cell coordinate A'</p>
  
  <p>I don't get this error if I only run one of the queries in the loop. Separately, both queries work. So I am pretty sure it has to do with the fact that the 2 queries are running. With the following code, there is one row inserted in both tables and then the error. Any ideas on how to fix this?</p>
  
  <p>Heres the code...</p>
  
  <pre><code>$dbc = odbc_connect(DB_DRIVER, DB_USER, DB_PASSWORD);
  $inputFileName = 'lib/test.xlsx';
  
  try {
      $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
      $objReader = PHPExcel_IOFactory::createReader($inputFileType);
      $objPHPExcel = $objReader-&gt;load($inputFileName);
  } catch(Exception $e) {
      die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e-&gt;getMessage());
  }
  
  //  Get worksheet dimensions
  $sheet = $objPHPExcel-&gt;getSheet(0); 
  $highestRow = $sheet-&gt;getHighestRow(); 
  $highestColumn = $sheet-&gt;getHighestColumn();
  
  //  Loop through each row of the worksheet in turn
  for ($row = 2; $row &lt;= $highestRow; $row++){ 
  //  Read a row of data into an array
  $rowData = $sheet-&gt;rangeToArray('A' . $row . ':' . $highestColumn . $row,
                                  NULL,
                                  TRUE,
                                  FALSE);
  
  $name = ms_escape_string($rowData[0][0]);
  $city = ms_escape_string($rowData[0][2]);
  $state = ms_escape_string($rowData[0][3]);
  $phone = ms_escape_string($rowData[0][4]);
  $website = ms_escape_string($rowData[0][5]);
  $profit_status = ms_escape_string($rowData[0][6]);
  
  $query = "insert into account2 ([name], [city], [state], [phone], [website], [type], [created_by], [last_modified_by]) 
  values ('$name', '$city', '$state', '$phone', '$website', '6', '3', '3')
  SELECT SCOPE_IDENTITY() AS ins_id";
  
  $data = odbc_exec($dbc, $query);
  
  if (odbc_next_result($data)){
      while ($row = odbc_fetch_object($data)) {
          $account_id = $row-&gt;ins_id;
      }
      $query = "insert into account_hic2 (account_id, profit_status)
  values ('$account_id', '$profit_status')";
  }
  $data2 = odbc_exec($dbc, $query);
  
  odbc_free_result($data);
  odbc_free_result($data2);
  }
  </code></pre>