Odoo Help

0

How shall I read out data from a binary Excel file by Python?

By
vx2008
on 7/17/16, 10:15 AM 1,460 views

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?

1
Taher Giyori
On 7/18/16, 9:28 AM

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.

vx2008
on 7/19/16, 4:51 AM

Another problem: shall I write the modified data back into a new Excel file?

vx2008
on 7/20/16, 10:30 PM

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.

Taher Giyori
on 7/23/16, 5:13 AM

ok, thank you

vx2008
on 7/24/16, 9:22 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 7/17/16, 10:15 AM
Seen: 1460 times
Last updated: 7/19/16, 4:51 AM