# pip install openpyxl
# openpyxl只能用于处理xlsx,不能用于处理xls
from openpyxl import load_workbook
# 打开文件
ExcelFullName = ‘c://平台软件开发部工资报表(2017-6).xlsx‘
wb = load_workbook(ExcelFullName)
# 遍历表格
for table in wb:
for row in range(1, table.max_row + 1):
for col in range(1, table.max_column + 1):
Data = table.cell(row=row, column=col).value
print(Data)
table.cell(row=1, column=1).value = ‘黄海的修改测试‘
wb.save(filename=ExcelFullName)