2022-12-14

python select sheet and int to str example

from openpyxl import load_workbook
wb = load_workbook(filename = '2022bj.xlsx')
ws = wb['seoul22'] ## sheet 이름이 seoul22 

a='f1'

print(ws[a].value)
print(ws['f2'].value)
print(ws['f3'].value)

for i in range(1,100):
    a='f'+str(i) # f1 f2 f3 ...
    print(i-1, ws[a].value)

wb.close()    

댓글 없음:

댓글 쓰기