Rictrunks Rictrunks - 1 year ago 118
Python Question

Python Excel Writer (xlswriter) Insert Image from URL

How can I insert an image from URL (http) with xlswriter? This is from documentation:

worksheet.insert_image('B2', 'python.png')


worksheet1.insert_image('B10', '../images/python.png')

But this is only for file path. I want to add image from URL from a Web Server. Can you help?

Answer Source
url = "http://abcdef.com/picture.jpg"
data = urllib.request.urlopen(url).read()
file = open("image.jpg", "wb")
worksheet.insert_image('B2', 'image.jpg')