Russ, glad you found a way to do it. I have a few comments on using session variables for this type of thing.
- Generally it is advised to not use session variables for very large amounts of data, but if you know that your data table is relatively small, it's ok to do it temporarily.
- Be sure you remove the session variable after you add it to the Excel file by doing Session.Remove("dataTableToExcel") or Session.RemoveAll().
- I have run into major problems using session variables for page related data, because if you user opens a new tab and goes back to the original page a new dataTableToExcel variable will be placed in the session variable and overwrite the original data. It is possible that the action in one browser tab would corrupt the data stored by the other browser tab just when it is being read into the Excel file. You would end up with rare cases of data corruption that disappear when they rerun it, and it is very hard to debug things like that.