〇概要
from openpyxl import load_workbook
f_name = ‘./data.xlsx’
workbook = load_workbook(filename = f_name, read_only = True)
sheet = workbook[‘Sheet1’]
a01 = sheet[‘A1’].value
a02 = sheet[‘C3’].value
a03 = sheet.cell(row = 2, column = 2).value
a04 = sheet.cell(row = 1, column = 2).value
print(a01, a02, a03, a04)
list = []
for i in range(3):
list.append(sheet.cell(row = i+1, column = 2).value)
print(list)
workbook.close()
aaa iii eee bbb
[‘bbb’, ‘eee’, ‘hhh’]
|