콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
14948 화면

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?

아바타
취소
베스트 답변

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.

작성자

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.

작성자

ok, thank you

관련 게시물 답글 화면 활동
7
6월 20
20776
1
11월 22
2587
0
1월 22
2825
7
1월 24
15210
0
7월 19
2512