это формат для добавления изображений на листе
import xlsxwriter
# Create an new Excel file and add a worksheet.
workbook = xlsxwriter.Workbook('images.xlsx')
worksheet = workbook.add_worksheet()
# Widen the first column to make the text clearer.
worksheet.set_column('A:A', 30)
# Insert an image.
worksheet.write('A2', 'Insert an image in a cell:')
worksheet.insert_image('B2', 'python.png')
# Insert an image offset in the cell.
worksheet.write('A12', 'Insert an image with an offset:')
worksheet.insert_image('B12', 'python.png', {'x_offset': 15, 'y_offset': 10})
# Insert an image with scaling.
worksheet.write('A23', 'Insert a scaled image:')
worksheet.insert_image('B23', 'python.png', {'x_scale': 0.5, 'y_scale': 0.5})
workbook.close()
В случае сохранения изображения в Odoo посмотрите здесь пример использования openpyxl, используйте тот же формат.
from openpyxl import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.drawing import Image
from PIL import Image as PILImage
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
wb = Workbook()
ws = wb.get_active_sheet()
#extra has the data of the image from the database
im = PILImage.open(StringIO(extra))
img = Image(im)
img.anchor(ws.cell('F1'))
ws.add_image(img)
handler = StringIO()
writer = ExcelWriter(wb)
writer.save(handler)
xls = handler.getvalue()
handler.close()