从xlwt的WorkBook中没有找到除add_sheet之外的其他sheet添加方式
但是,可以对这个方法进行修改后完成指定位置的sheet页添加
def insert_sheet(self, sheetname, cell_overwrite_ok=False, index=0):
"""
This method is used to create Worksheets in a Workbook.
:param sheetname:
The name to use for this sheet, as it will appear in the
tabs at the bottom of the Excel application.
:param cell_overwrite_ok:
If ``True``, cells in the added worksheet will not raise an
exception if written to more than once.
:return:
The :class:`~xlwt.Worksheet.Worksheet` that was added.
"""
from . import Utils
from .Worksheet import Worksheet
if not isinstance(sheetname, unicode_type):
sheetname = sheetname.decode(self.encoding)
if not Utils.valid_sheet_name(sheetname):
raise Exception("invalid worksheet name %r" % sheetname)
lower_name = sheetname.lower()
if lower_name in self.__worksheet_idx_from_name:
raise Exception("duplicate worksheet name %r" % sheetname)
self.__worksheet_idx_from_name[lower_name] = len(self.__worksheets)
self.__worksheets.insert(index,Worksheet(sheetname, self, cell_overwrite_ok))
return self.__worksheets[index]
其实就是List中的append操作变为insert,并修改相应的操作
不过这样就修改了xlwt中原生的内容