Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
14637 Zobrazení

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?

Avatar
Zrušit
Nejlepší odpověď

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()
Avatar
Zrušit
Autor

exactly, it runs very well;

Thanks for your help.

Autor

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.

Autor

ok, thank you

Related Posts Odpovědi Zobrazení Aktivita
7
čvn 20
20251
1
lis 22
2317
0
led 22
2584
7
led 24
14879
0
čvc 19
2309