

Separate subject.with regard to the protected cells issue, I have not personally needed to implement password protection, but the sheets I'm generating do have several columns with information we do not want the users altering. Once I switched to the latter, large spreadsheets generate in just a few seconds with no funk. In the end, it was the same issue others described here with using SpreadsheetFormatCell vs. Anything over 600 records or so would always timeout, and generate a really funky spreadsheet to boot. I also had a problem with spreadsheet generation being extremely slow. Late to the game here, but wanted to add my two cents for posterity, and because the comments here REALLY helped me out. Note I also added a cfheader to give it a proper name. It now sends the Excel sheet directly to the user. Here's the entire modified version of app. Luckily you can just wrap the variable with SpreadSheetReadBinary:

The variable is expected to contain binary data. Given my first example uses a variable called S, you can just do this:Īttribute validation error for tag cfcontent.Ĭ is not a supported variable type. (Not too difficult with a scheduled task.) But is there an even simpler way? If you don't need to save the Excel file on the server, then just pass it to the user via cfcontent. You can get around it by using a random name, maybe something like this:īut then you've got the job of cleaning up the files later on. If you guessed mass chaos and destruction, you win.

Great, now what happens when two people run the application at the same time? Given that you might want to generate random Excel files for different users, how would you ensure that one user doesn't get another user's file? For example, if you follow my first sample you can see that the resultant Excel is saved to a file called myexcel.xls. (You can find links to them at the bottom of this blog post.) I was having an email conversation with a reader when an interesting technique came up. A few weeks ago I blogged a few quick and simple CFSpreadSheet examples.
