Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
12414 Widoki

Hi;

how to create button and method to import Excel file?

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
wrz 23
1337
1
lip 18
4320
0
mar 15
3925
0
lis 24
3918
2
lis 24
1203