我們可以使用迴圈概念,來取得儲存格區間的內容
#ch2_8.py
import openpyxl
fn = "out1_4.xlsx"
wb = openpyxl.load_workbook(fn)
ws = wb.active
for i in range(1,ws.max_column+1):
print(ws.cell(row=1,column=i).value, end=' ')
#ch2_8.py
import openpyxl
fn = "out1_4.xlsx"
wb = openpyxl.load_workbook(fn)
ws = wb.active
for i in range(1,ws.max_row+1):
print(ws.cell(row=i,column=1).value)
明天運用雙層迴圈,讀取這個區域的每一個儲存格