import openpyxl import csv # 打开 Excel 文件 workbook = openpyxl.load_workbook('example.xlsx') # 选择工作表 sheet = workbook['Sheet1'] # 导出数据到 CSV 文件 with open('example.csv', 'w', newline='') as file: writer = csv.writer(file) for row in sheet.iter_rows(): writer.writerow([cell.value for cell in row])