hi,
i have uploaded an xls file into a wizard, and how i access the values in the xls file from the BINARY FIELD. please help
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
hi,
i have uploaded an xls file into a wizard, and how i access the values in the xls file from the BINARY FIELD. please help
hello
try like below code
import xlrd
import tempfile
import binascii
@api.multi def your_method(self): fp = tempfile.NamedTemporaryFile(suffix=".xlsx") fp.write(binascii.a2b_base64(self.xls_file)) fp.seek(0) workbook = xlrd.open_workbook(fp.name) sheet = workbook.sheet_by_index(0)
for row_no in range(sheet.nrows): if row_no <= 0: fields = map(lambda row:row.value.encode('utf-8'), sheet.row(row_no)) else: line = list(map(lambda row:isinstance(row.value, str) and row.value.encode('utf-8') or str(row.value), sheet.row(row_no)))
print ("==========",line) # in this line variable you get the value line by line from excel.
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 7 25
|
4709 | ||
|
2
thg 12 24
|
7833 | ||
How to ORDER BY? [Odoo 10]
Đã xử lý
|
|
2
thg 11 24
|
28621 | |
|
2
thg 5 24
|
7546 | ||
|
3
thg 3 24
|
6977 |