![73bc5c804794176eeeaffe231649d090.png](https://img-blog.csdnimg.cn/img_convert/73bc5c804794176eeeaffe231649d090.png)
1、打开表格文件
from openpyxl import load_workbook
wb = load_workbook(r"文件路径工作簿文件全名")
2. 查看有哪些sheet页
sheet_names = wb.sheetnames
print(sheet_names)
3. 读取指定的sheet页
sheet1 = wb['指定工作表的名字']
4.单元格的使用
#写
sheet1.cell(row=3,column=1,value=10)
wb.save('工作簿文件全名')
#读的两种方法
#c=sheet1['A1']
#读取多个单元格的数据
#cell_range = sheet1['A1':'C2']
#读取所有单元格数据
cell_range = sheet1['A1':'C2']
#读取所有单元格数据
get_cell_collection()
#打印最大列数
print(sheet1.max