I have tried the below code to create excel file with sheetnames. Sheets are created but empty. And one new sheet with only ws2 data is found. Can sonmeone help rewrite this.
workbook = openpyxl.Workbook()
ws1 = workbook.create_sheet('ONE')
ws2 = workbook.create_sheet('TWO')
ws1 = workbook.active
ws2 = workbook.active
# Construct test worksheets with some content.
ws1['A1'] = 'ID'
ws1['B1'] = 'Text'
ws1['C1'] = 'Category'
ws1['A2'] = '234'
ws1['B2'] = 'Sample'
ws1['C2'] = 'ASD'
ws2['A1'] = 'ID'
ws2['B1'] = 'Text'
ws2['C1'] = 'Category'
ws2['A2'] = '566'
ws2['B2'] = 'Sample'
ws2['C2'] = 'PED'
ws2['A3'] = '896'
ws2['B3'] = 'SAmple'
ws2['C3'] = 'HEAD'
workbook.save('sam.xlsx')