How do I copy a set of cells from Excel and paste them as image in Word using Python ?
I am trying to automate some reports (in docx format). The excels are auto generated and then I have to manually copy cells from Excel and paste as image in Word.
I have done some research and found there are some libraries like python-docx (for word) and openpyxl (for excel). What I am not able to figure out is the copy and paste as image from excel to word.
I don't think this is an easy task. Because conversion Excel to image probably means the Python package/codes need to know how to render the excel content, which is a big step beyond read/write excel format. I don't know any Python package can do that.
Assume you're running Python codes in Windows, you may try to call COM to copy/paste directly from Excel to Word. I guess that would behave just like you manually Ctrl+C/V. Reference
If you prefer to convert to an image, may try a VBA script. Reference
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.