import openpyxl

import re

wb=openpyxl.load_workbook("test5.xlsx")

ws=wb.active

li1=[]

for row in ws.iter_rows(min_row=1,max_row=ws.max_row,max_col=ws.max_column):

li2=[]

for cell in row:

if cell.value==3000:

cell.value=5000

if isinstance(cell.value,str):

if "高小" in cell.value:

cell.value=re.sub(r"小","大",cell.value)

li2.append(cell.value)

li1.append(li2)

print(li1)

wb2=openpyxl.Workbook()

ws2=wb2.active

for row in range(len(li1)):

ws2.append(li1[row])

wb2.save('test5bf.xlsx')