I have a folder JanuaryDataSentToResourcePro that contain multiple .xlsx files.
I want to iterate through folder and convert all of them into .csv and keep the same file name.
For that I'm trying to implement glob, but getting an error: TypeError: 'module' object is not callable
import glob
excel_files = glob('*xlsx*')
for excel in excel_files:
out = excel.split('.')[0]+'.csv'
df = pd.read_excel(r'''C:\Users\username\Documents\TestFolder\JanuaryDataSentToResourcePro\ResourceProDailyDataset_01_01_2018.xlsx''', 'ResourceProDailyDataset')
df.to_csv(out)
I am new to python. Does it look right?
UPDATE:
import pandas as pd
import glob
excel_files = glob.glob("*.xlsx")
for excel in excel_files:
out = excel.split('.')[0]+'.csv'
df = pd.read_excel(excel, 'ResourceProDailyDataset')
df.to_csv(out)
But still not converting convert .xlsx to .csv