Ask Your Question
0

How to import excel file in field?

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

Zahin gravatar image Zahin
205 1 8 16

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.

delete close flag offensive retag edit

2 Answers

Sort by » oldest newest most voted
0

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

Borni DHIFI gravatar image Borni DHIFI flag of Tunisia
4449 6 19 37
http://www.linkedin.com/i...

Hi,

see this topice Read Excel files from Python

link publish delete flag offensive edit
0

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

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

link publish delete flag offensive edit

Comments

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(lead.data, 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

Documentation

You can download ebooks on Facebook or buy paper book

You can read the online documentation

Question tools

Follow
1 follower

subscribe to rss feed

Stats

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

Seen: 389 times

Last updated: May 30 '13