I have an excel file with 3 columns: id, url1 and url2. Both url1 and url2 contain the URL of an image.
How to get the images and paste to WORD and PDF in a table format? There are 3 columns: id, image from url1 and image from url2.
import pandas as pd
import urllib
from docx import Document
from docx.shared import Inches
df = pd.read_excel('data.xlsx')
document = Document()
p = document.add_paragraph()
r = p.add_run()
r.add_picture('a.jpg')#OK
url = r'http://www.example.com/a.jpg'
r.add_picture(urllib.request.urlopen(url))#fail, how to do it?
document.save('demo.docx')
Thank you very much.