星期墨
2016-06-08 11:04Python3.4追加写入Excel表
3对于一个已存在的Excel表,怎么将一条新记录写到这个Excel表?
原先Python2.7是先打开Excel表,后复制表,获取sheet,读取rows,在第rows+1行写入数据,然后保存
#读取xls,
r_xls = ExcelRead.open_workbook('test.xls')
r_sheet = r_xls.sheet_by_index(0)
rows = r_sheet.nrows
w_xls = copy(r_xls)
sheet = w_xls.get_sheet(0)
sheet.write(rows, 0, "test")
w_xls.save('test.xls')
到时到了Python3,这个写法就报错,求解Python3.4该怎么写?
其中Python3.4用的是以下几个操作表格的库
from xlutils3.copy import copy
import xlrd
import xlwt
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- Python3.4追加写入Excel表
- python
- xlutils3
- 2个回答