Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
12416 Prikazi

Hi;

how to create button and method to import Excel file?

Avatar
Opusti
Best Answer

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
sep. 23
1337
1
jul. 18
4320
0
mar. 15
3925
0
nov. 24
3918
2
nov. 24
1203