Batch rename and xls to csv


'''
#Remove spaces from filename
import os
path  = 'C:\\Users\\gaura\\Downloads\\estmst' #os.getcwd()
filenames = os.listdir()
for filename in filenames:
    os.rename(os.path.join(path, filename), os.path.join(path, filename.replace(' ', '-')))
    '''


import os, pandas as pd
path  = 'C:\\Users\\gaura\\Downloads\\estmst'

for filename in os.listdir(path):
    data_xls = pd.read_excel(filename, 'Main Dashboard Excel', index_col=None)
    data_xls.to_csv(filename+'.csv', encoding='utf-8', index=False)

Comments

Popular posts from this blog

Tumblr posts about sexplanation, DoeEyes and Dr. Lindsay Doe

बैगन

Type of Common Charts used in visualization