title: Python; scientific notation string to number
body: <p>I am currently converting a file from csv to xlsx. The problem is that the data is default converted all to strings. How can I convert the numbers (typically shown as +1.50000000000E+009 or " +1.50000000000E+009" (leading space) from string to number representations. I've tried typecasting and general workarounds but nothing works.</p>
  
  <p>The "IF" statement is because the csv file has a header.</p>
  
  <pre><code>def csv_to_excel(csv_path, delimiter, delimiter_txt, excel_path, excel_title):
  csv_file = open(csv_path, 'r')
  csv.register_dialect(delimiter_txt, delimiter=delimiter)
  
  reader = csv.reader(csv_file, dialect=delimiter_txt)
  
  wb = Workbook()
  
  ws = wb.worksheets[0]
  ws.title = excel_title
  for row_index, row in enumerate(reader):
      for column_index, cell in enumerate(row):
          column_letter = get_column_letter((column_index + 1))
          if row_index &gt; 3:
              ws.cell('%s%s'%(column_letter, (row_index + 1))).value = float(cell)
          else:
              ws.cell('%s%s'%(column_letter, (row_index + 1))).value = cell
          print(cell)
          print(type(cell))
  wb.save(filename = excel_path)
  csv_file.close()
  </code></pre>
  
  <p>csv_to_excel('file.csv',',','comma','file.xlsx','data')</p>
  
  <p>Thanks! Any help would be great!</p>