3.使用 xlutils 修改Excel数据
1
2
3
4
5
6
7
8
9
10
|
# -*- coding:utf-8 -*- import xlrd from xlutils.copy import copy book1 = xlrd.open_workbook( 'D:\Excel.xls' ) # 打开要修改的excel book2 = copy(book1) # 拷贝一份原来的excel sheet = book2.get_sheet( 0 ) # 获取第几个sheet页 sheet.write( 1 , 1 , 28 ) # 写入需要修改的行、列及修改后的值 sheet.write( 5 , 0 , 'mike' ) book2.save( 'D:\Excel.xls' ) |