title: Importing from Excel to MySQL Table Using Python 2.7
body: <p>I'm trying to insert into a MySQL table from data in this Excel sheet: <a href="https://www.dropbox.com/s/w7m282386t08xk3/GA.xlsx?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/w7m282386t08xk3/GA.xlsx?dl=0</a> </p>
  
  <p>The script should start from the second sheet "Daily Metrics" at row 16. The MySQL table already has the fields called date, campaign, users, and sessions.</p>
  
  <p>Using Python 2.7, I've already created the MySQL connection and opened the sheet, but I'm not sure how to loop over those rows and insert into the database.</p>
  
  <pre><code>import MySQLdb as db
  from openpyxl import load_workbook
  
  wb = load_workbook('GA.xlsx')
  sheetranges = wb['Daily Metrics']
  print(sheetranges['A16'].value)
  
  conn = db.connect('serverhost','username','password','database')
  
  cursor = conn.cursor()
  
  cursor.execute('insert into test_table ...')
  
  conn.close()
  </code></pre>
  
  <p>Thank you for you help!</p>