Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
14963 Visninger

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
Kassér
Bedste svar

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
Kassér
Forfatter

exactly, it runs very well;

Thanks for your help.

Forfatter

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.

Forfatter

ok, thank you

Related Posts Besvarelser Visninger Aktivitet
7
jun. 20
20800
1
nov. 22
2674
0
jan. 22
2845
7
jan. 24
15305
0
jul. 19
2522