leave island

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
# _*_ coding:utf8 _*_
import xlrd
from xlutils.copy import copy

sheets = xlrd.open_workbook(r'D:\111.xlsx') #打开文件
sheet1 = sheets.sheet_by_index(0) #查看第一页
print sheet1.cell(0, 0).value.encode('utf-8') #查看第一行的第一列单元格内容

new_excel = copy(sheets) #复制文件
ws = new_excel.get_sheet(0) #读取第一页
ws.write(0, 0, "If you") #往第一行的第一列单元格写入内容
new_excel.save(r'D:\111.xlsx') #保存文件
posted on 2018-01-24 10:49  恒-星  阅读(640)  评论(0)    收藏  举报