Ask Your Question

How to import excel file in field?

asked 2013-05-30 13:38:32 +0200

Zahin gravatar image Zahin
205 1 8 16


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?


delete close flag offensive retag edit

2 Answers

Sort by » oldest newest most voted

answered 2013-05-30 14:10:30 +0200

Borni DHIFI gravatar image Borni DHIFI flag of Tunisia
4449 6 19 37


see this topice Read Excel files from Python

link publish delete flag offensive edit

answered 2013-05-30 14:10:10 +0200

Alexander gravatar image Alexander flag of Russian Federation
191 3 6 10

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):

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

link publish delete flag offensive edit


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

Zahin ( 2013-05-30 14:31:05 +0200 )edit

Try to use something like that.

excelfile = base64.decodestring(excelfile)

And don't forget make

import base64
Alexander ( 2013-05-30 14:42:21 +0200 )edit

I have try

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

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

Zahin ( 2013-05-30 15:20:02 +0200 )edit

Login/Signup to Answer


You can download ebooks on Facebook or buy paper book

You can read the online documentation

Question tools

1 follower

subscribe to rss feed


Asked: 2013-05-30 13:38:32 +0200

Seen: 389 times

Last updated: May 30 '13