DEV Community

Venkata reddy
Venkata reddy

Posted on

Need to show save as option for excel download from URL

Hi Team
I am downloading the excel file from api, its downloading successfully into download folder directly but I need to show Save as option for downloading file and I need to save where ever I want.
Please help on this
Am using both axios and filesaver package also
`
`axios.get('url', { responseType: 'arraybuffer' })
.then((response) => {
var blob = new Blob([response.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
FileSaver.saveAs(blob, "downloading.xlsb");
});

or
const type = response.headers['content-type']
const blob = new Blob([response.data], { type: type })
const link = document.createElement('a')
link.href = window.URL.createObjectURL(blob)
link.download = 'STA_VIIV_and_Halt_Tracking.xlsb'
link.click()

Top comments (0)