Sep-12-2017, 11:16 PM
Thanks, that did it! I used:
I managed to copy the new class sheet with photos into the old excel file which saved the day.
# put the pics in the excel file in column 1 for filename in os.listdir(pathToPhotos): if not (filename.endswith('.jpg')): continue for rowNum in range(beginRow, ws.max_row + 1): getName = filename.split('.') if (getName[0] == ws.cell(row=rowNum, column=col).value): print('found the name! Name is: %s ' % (getName[0])) print('Putting pic in row ' + str(rowNum)) img = Image(pathToPhotos + filename) ws.add_image(img, 'A' + str(rowNum))Which worked fine. However, other sheets in this excel file already had photos which I had manually inserted. Luckily, I saved the file as filename_copy.xlsx , because, when I looked, all the other photos for old classes were gone!! I do not know why!
I managed to copy the new class sheet with photos into the old excel file which saved the day.