>>> wb.get_sheet_by_name('zy110')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
wb.get_sheet_by_name('zy110')
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\compat\__init__.py", line 60, in new_func
return obj(*args, **kwargs)
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 211, in get_sheet_by_name
return self[name]
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 237, in __getitem__
raise KeyError("Worksheet {0} does not exist.".format(key))
KeyError: 'Worksheet zy110 does not exist.'
>>> wb.get_sheet_by_name('zy110')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
wb.get_sheet_by_name('zy110')
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\compat\__init__.py", line 60, in new_func
return obj(*args, **kwargs)
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 211, in get_sheet_by_name
return self[name]
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 237, in __getitem__
raise KeyError("Worksheet {0} does not exist.".format(key))
KeyError: 'Worksheet zy110 does not exist.'
>>> wb.get_sheet_by_name('zy110')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
wb.get_sheet_by_name('zy110')
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\compat\__init__.py", line 60, in new_func
return obj(*args, **kwargs)
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 211, in get_sheet_by_name
return self[name]
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 237, in __getitem__
raise KeyError("Worksheet {0} does not exist.".format(key))
KeyError: 'Worksheet zy110 does not exist.'
>>> wb.get_sheet_by_name('zy110')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
wb.get_sheet_by_name('zy110')
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\compat\__init__.py", line 60, in new_func
return obj(*args, **kwargs)
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 211, in get_sheet_by_name
return self[name]
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 237, in __getitem__
raise KeyError("Worksheet {0} does not exist.".format(key))
KeyError: 'Worksheet zy110 does not exist.'
思路三:创建和删除工作表
>>> wb.get_sheet_by_name('zy110')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
wb.get_sheet_by_name('zy110')
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\compat\__init__.py", line 60, in new_func
return obj(*args, **kwargs)
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 211, in get_sheet_by_name
return self[name]
File "C:\Users\goodb\AppData\Local\Programs\Python\Python36\lib\site-packages\openpyxl\workbook\workbook.py", line 237, in __getitem__
raise KeyError("Worksheet {0} does not exist.".format(key))
KeyError: 'Worksheet zy110 does not exist.'