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

I upload an excel file on odoo by “fields.Binary” and assign it to “filedata”;

now I think it is an binary format, I want to read out its data from the “filedata”, How shall I?

アバター
破棄
最善の回答

use this code to convert and save it to a file

import base64

f = open("/path/to/file/spreadsheet.xls", "wb")
f.write(self.filedata.decode('base64'))

# f.read()

f.close()
アバター
破棄
著作者

exactly, it runs very well;

Thanks for your help.

著作者

Another problem: shall I write the modified data back into a new Excel file?

Assuming you mean to modify your excel file (Binary data),

after modifying, you will need to reassign the excel file to your field, or you can do this through the UI itself.

著作者

ok, thank you

関連投稿 返信 ビュー 活動
7
6月 20
20107
1
11月 22
2218
0
1月 22
2492
7
1月 24
14756
0
7月 19
2247