Python-100-Days/Day01-15/code/Day15/excel2.py

21 lines
437 B
Python
Raw Normal View History

2018-09-25 22:49:21 +08:00
"""
读取Excel文件
Version: 0.1
Author: 骆昊
Date: 2018-03-26
"""
from openpyxl import load_workbook
from openpyxl import Workbook
workbook = load_workbook('./res/学生明细表.xlsx')
print(workbook.sheetnames)
sheet = workbook[workbook.sheetnames[0]]
print(sheet.title)
for row in range(2, 7):
2019-05-03 21:17:36 +08:00
for col in range(65, 70):
cell_index = chr(col) + str(row)
print(sheet[cell_index].value, end='\t')
print()