import openpyxl
# You must change the physical path before running this script.
currPath = "C:/Users/natio/OneDrive - 성균관대학교/99. Personal Blog/05. Python/05. OPENPYXL_XLRD_XLWT/01. Excel Sheet/"
wb = openpyxl.load_workbook(filename=currPath+"Sample Sheet File.xlsx")
ws = wb.active
# print the sheet name
print('Active sheet name : ', ws.title)
Result
Active sheet name : Sample Sheet
엑셀 시트 개수 확인
import openpyxl
from openpyxl import load_workbook
# You must change the physical path before running this script.
currPath = "C:/Users/natio/OneDrive - 성균관대학교/99. Personal Blog/05. Python/05. OPENPYXL_XLRD_XLWT/01. Excel Sheet/"
# # Load the excel file
wb = openpyxl.load_workbook(filename=currPath+"Sample Sheet File.xlsx")
res = len(wb.sheetnames)
# Number of sheets
print('Number of sheets : ', res, 'sheets')