How to switch between sheets in excel openpyxl python to make changes -


import openpyxl wb = openpyxl.load_workbook('d:\excel.xlsx') wb.get_sheet_names() 

after this, can see worksheets(85) excel file has. want go each sheet, edit data in 2-3 cells (which same sheets) , save file.

i new python , need help. thanks

in case see easiest probably

import openpyxl  n = 0 wb = openpyxl.load_workbook('d:\excel.xlsx') sheets = wb.sheetnames ws = wb[sheets[n]] 

where n sheetnumber (0 first). put in loop , increase n when want change sheet.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -