赞
踩
import pandas as pd
import openpyxl
import xlwt
import time
wb=openpyxl.load_workbook(r'D:\demo.xlsx')
print(wb)
new_wb=xlwt.Workbook()
for sheet_name in wb.sheetnames:
ws=wb[sheet_name]
new_ws=new_wb.add_sheet(sheet_name)
for row in ws.iter_rows():
for cell in row:
new_ws.write(cell.row-1,cell.col_idx-1,cell.value)
new_wb.save(r'D:\demotest.xls')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。