Odoo Help

2

0
1 Answer
1
Avatar

Mitul Shingala India

--Mitul Shingala--
5354
| 6 4 9
Vadodara, Gujarat, India
--Mitul Shingala--

Odoo Developer

Mitul Shingala India
1/9/19, 3:58 AM

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.
Ask a Question
Writer
Tag
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now