Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
12415 Visualizzazioni

Hi;

how to create button and method to import Excel file?

Avatar
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
set 23
1337
1
lug 18
4320
0
mar 15
3925
0
nov 24
3918
2
nov 24
1203