convert XML into xlsx

  Kiến thức lập trình

I’m trying to convert an XML into xlsx using the following code in python:

with open(str(Path.cwd())+'test.xml', "rb") as f1:
    with open(str(Path.cwd())+'test.xlsx', "wb") as f2:
        f2.write(f1.read())
        f2.close()
xlsx = pd.ExcelFile(str(Path.cwd())+'test.xlsx')

but I’m getting the following error:

xlsx = pd.ExcelFile(str(Path.cwd())+'test.xlsx')
ValueError: Excel file format cannot be determined, you must specify an engine manually.

is there a way to convert the xml into xlsx file directly?

1

LEAVE A COMMENT