1.安装模块
pip install openpyxl
2.使用方法
import openpyxl def main(): # 打开工作簿 wb = openpyxl.load_workbook('qqq.xlsx') # 获取表单 sh = wb['Sheet1'] # 按行读取 rows = sh.rows # 循环每行 for row in list(rows): # 循环每列 for i in row: # 打印每个格子的值 print(i.value) if __name__ == '__main__': main()