Oct-02-2022, 03:11 AM
In the following code I want the initial sheet name to change from 'Sheet' to some other name. What code can I use to do this. Is there a way of making the initial sheet to a nane other than 'Sheet' from the beginning without even changing it afterwards?
from openpyxl import Workbook
# This function will create a default MS Excel file.
def create_excel_file(excel_file_name):
# creates Workbook object.
wb = Workbook()
# invoke Workbook.active property to create the initial worksheet i.e. ‘Sheet’
initial_work_sheet = wb.active
# workbook has an initial worksheet.
initial_sheet_names = wb.sheetnames
print(initial_sheet_names)
