Is there a way that I am not thinking of to export a set of queried data to Excel? And in doing so, I could place this script in a button? The tough part, I think, is going to be the user-friendly interface which allows the user to choose the variables that dictate which query he/she wants to be exported. Anyone have any ideas?
Two things you should look at in the user manual are the column selector component under reporting and system.dataset.exportExcel from the scripting functions. The column selector will allow a user to add/remove fields from the dataset at run time. This modified dataset can then be exported to excel with script
You can also use the Row Selector component to group your data into easy to manage slices. Both of these components require that you have the Reporting module, but you can use other tricks to select rows and columns without it.
You might also want to check out the Kymera Office Document Module which provides more robust functions for exporting to excel.