Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
13108 Prikazi

Hello,

I want to import excel file in openerp how to ?

I have binary field where I have save excel file. now button click I want to import data from excel to field which in my form view.

I need to parse excel and convert to dict then will do write.

but any good feature with in openerp?

Thanks.

Avatar
Opusti
Best Answer

Hi,

see this topice Read Excel files from Python

Avatar
Opusti
Best Answer

You can define on_cnange method, what would process uploaded file.

<field name="excelfile" on_change="on_file_load(excelfile)"/>

You need to write parsing method in your *.py file

def on_file_load(self, cr, uid, ids, excelfile, context=None):
    #do_something

In this case file would be parsed before you save object.

Avatar
Opusti
Avtor

Have you fixed already this, because this will gives base64 encode file.

Try to use something like that.

excelfile = base64.decodestring(excelfile)

And don't forget make

import base64
Avtor

I have try

base64.decode(lead.data, open("newcsv.xls", "w")) workbook = xlrd.open_workbook("newcsv.xls")

but got traceback AttributeError: 'str' object has no attribute 'readline'

Related Posts Odgovori Prikazi Aktivnost
4
maj 24
2925
3
nov. 23
7474
1
dec. 21
4719
1
jan. 19
3499
0
jul. 16
3511