You can read in your Excel file using openpyxl, gather the appropriate information, and then create a directory for each product. The images can be downloaded using the requests library. Below is a tested solution to your problem:
import os
import openpyxl
import requests
wb = openpyxl.load_workbook('A1.xlsx')
sheet = wb.active
rows = [tuple(cell.value for cell in row if cell.value is not None) for row in sheet] # convert the cells to text
dirnames = list()
images = list()
text = list()
for row in rows[1:]: # [1:], ignore column headers for better looping
if row[0] is not None:
dirnames.append('_'.join(row[:3])) # joins the Brand, Family, and Ref columns
images.append(row[3:-2]) # stores the uris in a tuple
text.append('\r\n'.join(row[-2:])) # joins the last two columns
for i in range(len(dirnames)):
if not(os.path.exists(dirnames[i])):
os.mkdir(dirnames[i]) # create the dir
os.chdir(dirnames[i]) # enter the dir
print('creating', dirnames[i])
for j, image in enumerate(images[i]): # for all of the images
imagereq = requests.get(image)
imagename = 'Img{}.png'.format(j + 1)
if imagereq.status_code == 200: # prevents filewriting errors for bad requests
with open(imagename, 'wb') as fp:
fp.write(imagereq.content)
print(' ' * 4 + 'image write successful for', imagename)
else:
print(' ' * 4 + 'could not download image {}, error'.format(imagename), imagereq.status_code, imagereq.reason)
with open('ProdDesc_and_Collection.txt', 'wb') as fp:
fp.write(text[i].encode('utf8'))
os.chdir('..') # back out of the dir
UPDATE: Code now works for multiple images per product and ignores empty cells