Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
14799 มุมมอง

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
7
มิ.ย. 20
20463
1
พ.ย. 22
2440
0
ม.ค. 22
2687
ODOO 12 how can we generate Excel report แก้ไขแล้ว
7
ม.ค. 24
15032
0
ก.ค. 19
2379