import openpyxl workbook = openpyxl.load_workbook('example.xlsx') worksheet = workbook.active # 读取第2列的数据 col_data = [cell.value for cell in worksheet['B']] # 读取第3行的数据 row_data = [cell.value for cell in worksheet[3]] print(col_data) print(row_data)