I would like to order my worksheets in a specific order (not alphabetical). In the past I have used Pandas DataFrame that was followed by a list.
DataFrame(csv_dict_list)[self.ORDER_LIST]
Right now I have to use the workbook and worksheet methods to create my worksheets. I have found out that you can call all worksheets by using workbook.worksheets() or worksbook.worksheets_objs() but I can't use a list there. Only lamba (I think) like this
workbook.worksheets_objs.sort(key=lambda x: x.name)
Use a different lambda function, like this : lambda x: sheetlist.index(x.name)
. Lambdas inherit the scope in which they are called, so they can reference lists that are created in their 'parent' scope.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With