I am trying to convert all xlsx files to csv files in a folder. It worked well in the past, but I am getting an error this time that leaves me no clue.
Here's my code:
excel_files = glob.glob('/*xlsx*')
for excel_file in excel_files:
df = pd.read_excel(excel_file)
output = excel_file.split('.')[0]+'.csv'
df.to_csv(output)
I have also tried the following line to make sure it's not the encoding issue:
df.to_csv(output, encoding='utf-8', index=False)
It converted around 1000 files, but the rest of the 7000 files kept getting the error:
KeyError: 'rId6'
How would you solve it? Thank you.