Reputation: 21
I have a name tuple and I have a template worksheet. Now I want to copy the first worksheet, the times of copy are the number of the names (in the tuple), and the copied worksheets are renamed with all the names
wBookTongJi = openpyxl.load_workbook('D:\\example.xlsx')
tupleRequestStaff = ['Ross', 'Joy', 'Monica']
# from this I don't know how to code
for i in listRequestStaff
wBookTongJi.copy_worksheet(wBookTongJi['Sheet1']).title=...
Upvotes: 0
Views: 2697
Reputation: 21
just figure out my own problem
tupleRequestStaff=('Ross', 'Richul', 'Joy')
for i in range(len(tupleRequestStaff)):
wBookTongJi.copy_worksheet(wBookTongJi['Sheet1']).title =
tupleRequestStaff[i]
wBookTongJi.save('D:\\Users\\6-7.xlsx')
wBookTongJi.remove(wBookTongJi['Sheet1'])
wBookTongJi.save('D:\\Users\\6-7.xlsx')
Upvotes: 1