Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
14450 Представления

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
19904
1
нояб. 22
2082
0
янв. 22
2308
7
янв. 24
14615
0
июл. 19
2044