Update Task02 Python与Excel.md

This commit is contained in:
Muxiaoxiong 2021-06-16 18:12:25 +08:00 committed by GitHub
parent cc1d2a49f2
commit b819f5dcf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -135,9 +135,9 @@ from openpyxl import load_workbook
exl = load_workbook(filename = 'test.xlsx') exl = load_workbook(filename = 'test.xlsx')
sheet = exl.active sheet = exl.active
sheet['A1'] = 'hello word' sheet['A1'] = 'hello world'
#或者cell = sheet['A1'] #或者cell = sheet['A1']
#cell.value = 'hello word' #cell.value = 'hello world'
exl.save(filename = 'test.xlsx') #存入原Excel表中,若创建新文件则可命名为不同名称 exl.save(filename = 'test.xlsx') #存入原Excel表中,若创建新文件则可命名为不同名称
``` ```