本文摘自php中文网,作者不言,侵删。
这篇文章主要介绍了关于python 实现在Excel末尾增加新行,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下实例如下所:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import os
import xlrd
import xlwt
from xlutils. copy import copy
def 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中关于变量赋值操作的实例分享
Python基础教程之with、contextlib的实例用法详解
windows怎么打开Python
Python中tornado下用户身份认证的实现方法
Python中怎么安装pip工具?
Python基本数据类型有哪些
Python需要有编程的基础吗
Python自定义对象实现切片功能的介绍(代码示例)
Python怎么垂直输出
Python之列表操作实例教程
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python 实现在Excel末尾增加新行