-1

As shown in the below picture,there's an excel sheet and about 2,000 URLs of cover images in the F column. enter image description here 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.

Ringo
  • 1,173
  • 1
  • 12
  • 25
  • Take it step by step. Read the spreadsheet entries into a list then download each of them (if they return error remove from list I assume), then write back to the spreadsheet. if you google each of these individually, you should find out how they can be achieved (if not they are good candidates for questions). You just compose these together into an application and you will be finished. – Paul Rooney Jul 18 '18 at 03:15

1 Answers1

4

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
Massoud
  • 503
  • 4
  • 13