import openpyxl filename = 'aaa.xlsx' wb = openpyxl.load_workbook(filename) # 加載表格 wb.save("aaa.xlsx") sh_name = wb.sheetnames # 獲取所有sheet sh = wb[sh_name[0]] sh.title = "dddd" # 修改第一個sheet名為dddd wb.close()
# mac修改后,肉眼檢查沒反應,但是代碼檢測已經修改
import openpyxl filename = 'aaa.xlsx' wb = openpyxl.load_workbook(filename) # 加載表格 wb.save("aaa.xlsx") sh_name = wb.sheetnames # 獲取所有sheet sh = wb[sh_name[0]] sh.title = "dddd" # 修改第一個sheet名為dddd wb.close()
# mac修改后,肉眼檢查沒反應,但是代碼檢測已經修改
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。