openpyxl的讀取單行表單內容
從excel取到的類型:數字還是數字,其他都是字符串
1、在桌面新建一個excel文件,復制到pychram中
2、導入excel
from openpyxl import load_workbook
3、打開excel--(“文件名”)---必須雙引號,然后用wordbook來接收
wordbook1- = load_wordbook("test.xlsx")
4、定位表單 ,一共三個表單(test,sheel2,sheel3),定位test表單
sheet = wordbook["test"]
5、讀取test表單中的內容---(行,列).內容
data1 = sheet.cell(1,1).value
data2 = sheel.cell(1,2).value
data3 = shelel.cell(1,3).value
data4 = sheel.cell(1,4).value
打印獲取表單的內容
print("請求格式是:{},url是:{},data是:{},結果是:{}".forman(data1,data2,data3,data4))
獲取最大行 max_row
print("最大行是{}".format(sheel.max_row))
獲取最大列 max_column
print("最大列是{}".format(sheel.max_column))
openpyxl的讀取excel中全部數據