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 replace the URL with the image correspondingly.
Download,Insert the pictures into F column and remove the URLs automatically.
How to complement it with Python ? Any suggestion or code is welcomed.Thanks.
I hope this answers your question:
- 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.
- 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.
- Use XlsxWriter library to put them on their respective cell; see an example at
https://xlsxwriter.readthedocs.io/example_images.html