title: pass openpyxl data to pandas
body: <p>I am splitting &quot;full name&quot; fields into &quot;first name&quot;, middle name&quot; and &quot;last name&quot; fields from data from an excel file. I couldn't figure out how to do that in pandas, so I turned to openpyxl. I got the variables split as I desired. But, <a href="https://groups.google.com/forum/#!topic/openpyxl-users/wHGecdQg3Iw" rel="nofollow noreferrer">since adding columns to openpyxl for the new fields is not easy</a>, I thought I would pass the values to pandas.</p>
  <p>I'm generating the dataframe that I need when I run the code, but once I send the df to ExcelWriter, only the last row is added to the Excel file. The data is in the right places, though.</p>
  <p>Here's the code:</p>
  <pre><code>for cellObj in range(2, sheet.max_row+1):
      #print cellObj
      id = sheet['A' + str(cellObj)].value
      fullname = sheet['B' + str(cellObj)].value.strip()
      namelist = fullname.split(' ')  
      for i in namelist:
          firstname = namelist[0]
          if len(namelist) == 2:
              lastname = namelist[1]
              middlename = ''
          elif len(namelist) == 3:
              middlename = namelist[1]
              lastname = namelist[2]
          elif len(namelist) == 4:
              middlename = namelist[1]
              lastname = namelist[2] + &quot; &quot; + namelist[3]
          if (namelist[1] == 'Del') | (namelist[1] == 'El') | (namelist[1] == 'Van'):
              middlename = ''
              lastname = namelist[1] + &quot; &quot; + namelist[2]
      df = pd.DataFrame({'personID':id,'lastName':lastname,'firstName':firstname,'middleName':middlename}, index=[id])
  
      writer = pd.ExcelWriter('output.xlsx')
      df.to_excel(writer,'Sheet1', columns=['ID','lastName','firstName','middleName'])
      writer.save()
  </code></pre>
  <p>Any ideas?</p>
  <p>Thanks</p>