Skip to Content
Menu
This question has been flagged
1 Atsakyti
12322 Rodiniai

Hi;

how to create button and method to import Excel file?

Portretas
Atmesti
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.

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
rugs. 23
1251
1
liep. 18
4227
0
kov. 15
3849
0
lapkr. 24
3805
2
lapkr. 24
1108