The best way is to make the .xlsx file on the server side (with the jPOI library I think it is called). Save it in a folder under /www/ and then make a label with a link in it in the browser where the user can click on it to download it where they want. That is how we do it in our app.