I am trying to open all Excel (.xlsx) files in one folder and add three sheets (named M1, M2 and M3). Then save it in the existing Excel file (not mandatory). Can you please help? Thanks.
from openpyxl import load_workbook
wb2 = load_workbook(r'C:\Users\alex\mob\830.xlsx')
wb2.create_sheet('M1')
wb2.create_sheet('M2')
wb2.create_sheet('M3')
wb2.save(r'C:\Users\alex\mob\830.xlsx')
This works for each Excel file, but I want to iterate/loop/do it for all files in one folder. All files are .xlsx