title: Import Data from Excel to Mysql Python
body: <p>This code work well for String but the float column is not the same in Database, I don't understand how it is working, For Example in Excel file the value "215,325" in database "254.0835" and there is many other value changed.</p>
  
  <pre><code>import MySQLdb
  import xlrd
  
  list= xlrd.open_workbook("prod.xls")
  sheet= list.sheet_by_index(0)
  
  database = MySQLdb.connect (host="localhost" , user="root" , passwd="" ,db="table")
  cursor = database.cursor()
  
  query= """INSERT INTO produits (idProduit, idCategorie, LibelleProduit, PrixProduit) VALUES (%s, %s, %s, %s)"""
  
  
  
  for r in range(1,sheet.nrows):
      idProduit = sheet.cell(r,0).value
      categorie = 999
      libelle=sheet.cell(r,1).value
      prix=sheet.cell(r,3).value #&gt;&gt;&gt;&gt;&gt; HERE THE PROBLEM the Imported Value &lt;&lt;&lt;&lt;
  
  
      values = (idProduit,categorie,libelle,prix)
  
      cursor.execute(query,values)
  
  
  
  cursor.close();
  database.commit()
  
  database.close()
  
  print""
  print "All done !"
  
  columns= str(sheet.ncols)
  rows=str(sheet.nrows)
  print "i just import "+columns+" columns and " +rows+ " rows to MySQL DB"
  </code></pre>
  
  <p>also ,i tried to change the SQL Type to Varchar it was changed also.</p>