getting sheet names from openpyxl
Use the sheetnames
property:
sheetnames
Returns the list of the names of worksheets in this workbook.
Names are returned in the worksheets order.
Type: list of strings
print (wb.sheetnames)
You can also get worksheet objects from wb.worksheets
:
ws = wb.worksheets[0]
As a complement to the other answers, for a particular worksheet, you can also use cf documentation in the constructor parameters:
ws.title
python 3.x for get sheet name you must use attribute
g_sheet=wb.sheetnames
return by list
for i in g_sheet:
print(i)
**shoose any name **
ws=wb[g_sheet[0]]
or ws=wb[any name] suppose name sheet is paster
ws=wb["paster"]