pandas+xlrd操作excel批量读写全体sheet

import pandas as pd
import xlrd
xlsfile = r'D:\workfile\uv\wind.xls'
book = xlrd.open_workbook(xlsfile) 
#xlrd用于获取每个sheet的sheetname  
#count = len(book.sheets())
with pd.ExcelWriter('newxls.xls') as writer:
    for sheet in book.sheets():
        print sheet.name
        df = pd.read_excel(xlsfile,sheet.name,index_col = None,na_values= ['9999'])
        df.to_excel(writer,sheet_name = sheet.name)

你可能感兴趣的:(python)