Attach an Excel file to Attach field

I have generated an Excel file using openpyxl by clicking a button.
I am able to generate the file in /private/files and attach it to the Attach field.
But when I click on the field to download the file, I get 403 Forbidden You don’t have permission to access this file error.
File permissions are the same as the files uploaded from the UI. I am skipping any step?

@RWEMA_Aimable
You can download excel file excel using javascript too.