Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
12438 Vistas

Hi;

how to create button and method to import Excel file?

Avatar
Descartar
Mejor respuesta

Xml

<button name="import_xls" string="Import" type="object" />

Py

import base64
import xlrd
    xls_file = fields.Binary('File')

    def import_xls(self):
         wb = xlrd.open_workbook(file_contents=base64.decodestring(self.xls_file))
         for sheet in wb.sheets():
             for row in range(sheet.nrows):
                 for col in range(sheet.ncols):
                     print  (sheet.cell(row,col).value)

If helpful you , upvote this.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
sept 23
1351
1
jul 18
4341
0
mar 15
3950
0
nov 24
3936
2
nov 24
1218