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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -