I have a larger script that is supposed to read xlsx files, reformat and convert to csv files. But the code was written a few years ago and uses the xlrd module to open the Excel files but apparently the xlrd module no longer supports xlsx files. I am looking for a workaround to the xlrd error to update the script. The .xlsx files are in the same folder as the python script. I've narrowed down the issue to the snippet below.
def xls2csv(xlsfn, csvfn, xlsx2csv=None):
""" """
with xlrd.open_workbook(xlsfn) as wb:
sh = wb.sheet_by_index(0)
with open(csvfn, 'w', newline="") as f:
c = csv.writer(f)
for r in range(sh.nrows):
c.writerow(sh.row_values(r))