martes, 7 de abril de 2015

Importando campos tipo Fecha a Django/Python desde Excel




book = xlrd.open_workbook("archivo.xls")

sheet = book.sheet_by_name("source")
for r in range(1, sheet.nrows):
      fecha1       = sheet.cell(r,0).value
      fecha       = datetime.datetime(*xlrd.xldate_as_tuple(fecha1, book.datemode))
     
      values = (fecha)
      cursor.execute(query, values)





Fuentes: