There are a few things missing. If you are running this on the backend, then it is going to be harder to send it back to the front end to download. Why don’t you want to run it from the front end if you want them to click a button to download it?