コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
13105 ビュー

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.

アバター
破棄
最善の回答

Hi,

see this topice Read Excel files from Python

アバター
破棄
最善の回答

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.

Try to use something like that.

excelfile = base64.decodestring(excelfile)

And don't forget make

import base64
著作者

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'

関連投稿 返信 ビュー 活動
4
5月 24
2925
3
11月 23
7474
1
12月 21
4718
1
1月 19
3497
0
7月 16
3508