I am trying to open an excel workbook and iterate through each of the worksheets in a loop. Here is first loop:
wb = openpyxl.load_workbook('snakes.xlsx')
for i in wb.worksheets:
i= 0
wb.get_sheet_names()
i = i + 1
Once I can successful go through each one of these worksheets, i would like to do a nested loop which takes each one of my png files and places them in the worksheets. It is important to note that the sheet names and the png files have the same names (country names) stored in a dataframe called country_names.
Second loop:
for ws in wb.worksheets:
img = openpyxl.drawing.image.Image(folder + str(var) + '.png')
ws.add_image(img, 'K1')
wb.save('snakes.xlsx')
Any ideas on how to do the nested for loop so the code loops through the images and write them to the worksheets?