How to import excel file in field? | Odoo

Welcome!

This community is for professionals and enthusiasts of our products and services.

Register
0

How to import excel file in field?

By
Zahin
on 5/30/13, 9:38 AM1671 views

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.


0
Borni DHIFI
On 5/30/13, 10:10 AM

Hi,

see this topice Read Excel files from Python



-1
Alexander
On 5/30/13, 10:10 AM

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.


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

Zahin
on 5/30/13, 10:31 AM

Try to use something like that.

excelfile = base64.decodestring(excelfile)

And don't forget make

import base64
Alexander
on 5/30/13, 10:42 AM

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
on 5/30/13, 11:20 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/30/13, 9:38 AM
Seen: 1671 times
Last updated: 3/16/15, 8:10 AM