D365 CRM: Call external API to get a file and attach it in Notes

I have a button where a user clicks on it, javascript makes a GET request to an external API to create an excel file. I want this excel file to be attached at a Note record and be shown in the timeline.
While I have created the request via javascript and excel file is being generated, I don’t know how to ‘get’ this file and attach it in CRM