This article mainly introduced the Python to Excel inserts the picture the simple implementation method, combined with the instance form analysis Python uses the Xlsxwriter module operation Excel cell inserts the JPG format picture the related operation skill, is very simple and practical, needs the friend can refer to the next
This example describes a simple implementation of Python's insertion of a picture into Excel. Share to everyone for your reference, as follows:
Using Python to insert images into an Excel file, this feature was implemented through the XLWT module before learning XLWT. At that time was the attempt at the company, the impression inserted in the image eventually narrowed down to a cell, and because the company's encryption system so implemented the picture inserted in the Excel file cannot be opened again.
This test of this XlsxWriter
module, speculated that the module should be more powerful than the XLWT features. The code is implemented as follows:
#!/usr/bin/python#-*-codding:cp936-*-import xlsxwriterbook = xlsxwriter. Workbook (' pict.xlsx ') sheet = book.add_worksheet (' demo ') sheet.insert_image (' D4 ', ' vcfy6863.jpg ') book.close ()
After the execution of the program, an Excel file called Pict.xlsx is generated. When you open it, you can see that the image is inserted successfully, the insertion point is the specified cell, and the upper-left corner of the entire picture is specified in this cell. General information such as:
Insert feature implementation, but also a more ideal insert effect.