import openpyxl workbook = openpyxl.load_workbook('example.xlsx') worksheet = workbook.active # 根据条件筛选数据 filtered_data = [] for row in worksheet.iter_rows(min_row=1, max_row=worksheet.max_row, min_col=1, max_col=worksheet.max_column): if row[0].value == 'Apple': for cell in row: data = cell.value filtered_data.append(data) print(filtered_data)