方法一:
读取指定列的内容
def ReadCheckUrlOriData(sheetname):
listori = []
wb = openpyxl.load_workbook(excelpath)
checkUrlSheet = wb[sheetname] #打开指定sheet
#读取数据到listori中
for row1 in range(2,500): #2,500是excel中数据的行
listori.append(checkUrlSheet.cell(row=row1,column=3).value)
return listori
方法二:
读取整个excel的内容
def ReadOriData(sheetname):
listori = []
wb = openpyxl.load_workbook(excelpath)
wsoridata = wb[sheetname] #原始数据sheet
# #读取原始数据到listori中
for row in wsoridata.rows:
for cell in row:
listori.append(cell.value)
return listori