1import pandas as pd
2import os
3import glob
4
5
6source="D:\\source\\"
7dest='D:\\dest\\'
8os.chdir(source)
9
10for file in glob.glob("*.xls"):
11 df = pd.read_excel(file)
12 df.to_csv(dest+file+'.csv', index=False)
13 os.remove(file)
14for file in glob.glob("*.xlsx"):
15 df = pd.read_excel(file)
16 df.to_csv(dest+file+'.csv', index=False)
17 os.remove(file)