I have seen many examples on how to access the active sheet in an excel workbook, and how to specify which sheet to activate based on the name of the sheet, but is there a way to loop through all of the sheets without specifying the name of the sheets and perform a task on each on, even when I do not input the actual names of the sheet myself?
def main(workbook_name):
wb = openpyxl.load_workbook(workbook_name)
sheetNameList = wb.get_sheet_names()
for sheetName in sheetNameList:
[activate the sheet sheetName]
[perform function on sheetName]
wb.save(workbook_name)
so far my code only performs the function on the active worksheet because I cannot figure out how to activate the others.
I imagine there is a simple solution to this and I am just not finding the right function.
Thanks for your help.