Skip to content Skip to sidebar Skip to footer

Python: How To Download Images With The Urls In The Excel And Replace The Urls With The Pictures?

As shown in the below picture,there's an excel sheet and about 2,000 URLs of cover images in the F column. What I want to do is that downloading the pictures with the URLs and re

Solution 1:

I hope this answers your question:

  1. Write a loop over the rows using Pandas library; you might find https://pandas.pydata.org/pandas-docs/version/0.23/generated/pandas.read_excel.html and How to iterate over rows in a DataFrame in Pandas? interesting.
  2. Within every iteration save the corresponding picture into a folder (maybe name them with your Pandas index); Refer to python save image from url to learn how to save a picture from a URL.
  3. Use XlsxWriter library to put them on their respective cell; see an example at https://xlsxwriter.readthedocs.io/example_images.html

Post a Comment for "Python: How To Download Images With The Urls In The Excel And Replace The Urls With The Pictures?"