python excel spreadsheet modified sheet name

Import openpyxl 

filename = ' aaa.xlsx ' 
WB = openpyxl.load_workbook (filename)    # loading table 
wb.save ( " aaa.xlsx " ) 
, sh_name = wb.sheetnames   # accessories Sheet 
SH = WB [, sh_name [0]] 
SH. title = " dddd "   # modify the first sheet called dddd 
wb.close ()

# Mac after modification, visual inspection did not respond, but has been modified code detecting

Guess you like

Origin www.cnblogs.com/caijunchao/p/12500406.html