콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
12490 화면

Hi;

how to create button and method to import Excel file?

아바타
취소
베스트 답변

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.

아바타
취소
관련 게시물 답글 화면 활동
2
9월 23
1406
1
7월 18
4381
0
3월 15
4009
1
8월 25
283
0
11월 24
4018