I have an Excel sheet with 3 worksheets in it. I want to display a list of those sheets. This is what I have:
import openpyxl
wb = openpyxl.load_workbook('examples.xlsx')
print(wb.get_sheet_names())
This it the error I'm getting:
DeprecationWarning: Call to deprecated function get_sheet_names (Use wb.sheetnames).
wb.get_sheet_names()
I'm using Pycharm CE and the example.xlsx is in the same folder as the python file.
That is not an error, it's just a deprecation warning (link). Use sheetnames
instead of get_sheet_names()
.
import openpyxl
wb = openpyxl.load_workbook('examples.xlsx')
print(wb.sheetnames)