python: excel单元格读取写入

# _*_ 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') #保存文件
原文地址:https://www.cnblogs.com/heng-xin/p/8340566.html