Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
14918 Переглядів

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
20757
1
лист. 22
2565
0
січ. 22
2814
7
січ. 24
15195
0
лип. 19
2498