Skip to Content
Menu
This question has been flagged
1 Atsakyti
14951 Rodiniai

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?

Portretas
Atmesti
Best Answer

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()
Portretas
Atmesti
Autorius

exactly, it runs very well;

Thanks for your help.

Autorius

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.

Autorius

ok, thank you

Related Posts Replies Rodiniai Veikla
7
birž. 20
20779
1
lapkr. 22
2588
0
saus. 22
2825
7
saus. 24
15212
0
liep. 19
2513