这篇文章主要介绍了关于python 实现在Excel末尾增加新行,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
实例如下所:
import osimport xlrdimport xlwtfrom xlutils.copy import copydef excelwrite(L=None): if L is None: L = [] print(L) filename = r'wldata.xls' workbook = xlrd.open_workbook(filename, formatting_info=True) sheet = workbook.sheet_by_index(0) rowNum = sheet.nrows colNum = sheet.ncols newbook = copy(workbook) newsheet = newbook.get_sheet(0) # 在末尾增加新行 str = 'hehe' newsheet.write(rowNum, 0, str) # 覆盖保存 newbook.save(filename)
本文来源gaodai.ma#com搞##代!^码@网3
相关推荐:
Python实现的根据文件名查找数据文件功能示例
以上就是python 实现在Excel末尾增加新行的详细内容,更多请关注搞代码gaodaima其它相关文章!