Reputation: 103
I'm able to get the desired sheet by using wb["sheet_name"] method but I want to get the first, or let's say the nth sheet, regardless of the name.
wb = load_workbook(filename = xlsx_dir) # xlsx_dir is the workbook path
ws = wb["Details"] # Details is the sheet name
Upvotes: 10
Views: 10901
Reputation: 12
you need to use worksheet function sheet_by_name
sheet = wb.sheet_by_name("Details")
Upvotes: -6
Reputation: 1270
You need to use the worksheets
property of the workbook object
ws = wb.worksheets[0]
Upvotes: 32