I wrote the code to create an excel file for those who want to prepare an excel file like a memo instantly.
Installation of a library that handles Excel
terminal
pip install xlsxwriter
Implementation
sample.py
# -*- coding: utf-8 -*-
import xlsxwriter
workbook = xlsxwriter.Workbook('sample.xlsx')
worksheet = workbook.add_worksheet()
worksheet.set_column('A:A', 20)
worksheet.write('A1', u'Note')
worksheet.write('A2', u'Note)
worksheet.write('A3', u'Memo Memo')
worksheet.insert_image('C1', 'image1.jpg', {'x_scale': 0.03, 'y_scale': 0.03})
workbook.close()
Depending on the image, the image may be large, so adjust it on the scale.
sample.py
{'x_scale': 0.03, 'y_scale': 0.03}
Recommended Posts