虚位以待(AD)
虚位以待(AD)
首页 > 脚本专栏 > python > python 实现在Excel末尾增加新行

python 实现在Excel末尾增加新行
类别:python   作者:码皇   来源:互联网   点击:

下面小编就为大家分享一篇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)

以上这篇python 实现在Excel末尾增加新行就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:

  • Python中使用第三方库xlutils来追加写入Excel文件示例
  • Python读写Excel文件方法介绍
  • python excel使用xlutils类库实现追加写功能的方法
  • Python实现的Excel文件读写类
相关热词搜索: python 增加新行