import openpyxl as ol
if __name__ == '__main__':
workbook = ol.load_workbook("E:\\产品\\PSFMTF\\PSF_MTF.xlsx", data_only= True)
sheet1 = workbook['2D']
sheet2 = workbook['光场']
line_pair_2D = []
line_pair_LF = []
for i in range(8, 9):
for j in range(4, 19):
line_pair_2D.append(sheet1.cell(row=i, column=j).value)
line_pair_LF.append(sheet2.cell(row=i, column=j).value)
X_MTF_2D = []
X_MTF_LF = []
for i in range(12, 13):
for j in range(4, 19):
X_MTF_2D.append(sheet1.cell(row=i, column=j).value)
X_MTF_LF.append(sheet2.cell(row=i, column=j).value)
print(line_pair_2D)
print(line_pair_LF)
print(X_MTF_2D)
print(X_MTF_LF)
data_only = True意味着只读取数据,省略代表读取公式