Odoo Help

Welcome!

This community 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.

0

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

By
vx2008
on 7/17/16, 10:15 AM 422 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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