import openpyxl # 打开 Excel 文件 workbook = openpyxl.load_workbook('example.xlsx') # 选择工作表 sheet = workbook['Sheet1'] # 读取单元格数据 cell_value = sheet['A1'].value # 读取整列数据 column_data = [cell.value for cell in sheet['A']] # 读取整行数据 row_data = [cell.value for cell in sheet[1]]