Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
14751 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Autore

exactly, it runs very well;

Thanks for your help.

Autore

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.

Autore

ok, thank you

Post correlati Risposte Visualizzazioni Attività
7
giu 20
20397
1
nov 22
2406
0
gen 22
2653
7
gen 24
14978
0
lug 19
2355