D
D
Dmitry Vyatkin2016-02-03 05:13:58
Django
Dmitry Vyatkin, 2016-02-03 05:13:58

Why, when reading from an xlsx file using the xlrd library, data with a date is obtained in float format?

Good afternoon! Please tell me what is the reason that after reading from the file it turns out not data, but float?

def form_valid(self, form):
        f = self.request.FILES['file']
        rb = xlrd.open_workbook(filename=None, file_contents=f.read())
        sheet = rb.sheet_by_index(0)
        vals = [sheet.row_values(rownum) for rownum in range(sheet.nrows)]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Vyatkin, 2016-02-03
@dim137

You need to use xldate_as_tuple.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question