Issue
I am having issues downloading a file in Appsmith from an API that sends the data with content-type as application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. The downloaded file gets corrupted, but when I change the extension to CSV, I can see binary data. However, when I hit the request from Postman and save the response, the file opens without any issue. I have tried different codes, but the files downloaded are always a bit smaller than with Postman. A temporary solution is to return the file as a Base64 encoded field and decode it in Appsmith, but a permanent fix is being worked on.
Resolution
Several users reported issues with downloading Excel files from APIs in Appsmith. The files would either be corrupted or have a smaller size compared to downloading from other tools, such as Postman. The issue seems to be related to how Appsmith handles the response body and may cause some data to be truncated. One workaround is to have the API return the file as a Base64 encoded string and decode it in Appsmith before downloading. Another solution is to use the FileReader
API in JavaScript to read the file as a data URL and pass it to the download
function in Appsmith. The Appsmith team is aware of the issue and working on a permanent fix.