|
Python操作Excel文档的类库,挺多的,但是都存在各种问题,无法满足我们的需求,在http://www.zhlwish.com/2010/10/09/python_edit_excel/ 的《用Python修改Excel文件》中,给我带来了新的希望,于是我安装了:xlrd,xlwt,xlutils以及errorhandler。
并实现了下面一个例子:
#! /usr/bin/python
# -*- coding: utf-8 -*-
import xlrd
import xlutils.copy
if __name__ == '__main__':
template = u"1.xls"
workBook = xlrd.open_workbook(template, on_demand=True, formatting_info=True)
workBook = xlutils.copy.copy(workBook)
sheet = workBook.get_sheet(0)
sheet.write(0, 0, 'changed!111')
workBook.save('1.xls')
不给力呀,还是没找到解决方法,最后只能用win32com |
|
|