Python inserts a simple implementation of a picture into Excel

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.