1

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.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Raniendu Singh
  • 57
  • 1
  • 2
  • 15

1 Answers1

0

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

Community
  • 1
  • 1
ZZY
  • 3,689
  • 19
  • 22