Axios Excel file download using POST results in corrupted file

Finally got it working! The post syntax in the code block for the question was not correct and also changed the responseType to "arraybuffer".

Working example below:

downloadTemplate() {, null,
                'Content-Disposition': "attachment; filename=template.xlsx",
                'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
            responseType: 'arraybuffer',
    ).then((response) => {
        const url = window.URL.createObjectURL(new Blob([]));
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', 'template.xlsx');
        .catch((error) => console.log(error));