I would like to know how to export, automatically, the query result set to xls (or other file extensions). Currently we can do this manually after getting query results and then using the export option. But i would like to automate this.
Sorry, there's no way.
You can do automatic formatting of results to CSV though.
SELECT /*csv*/ ....
execute via F5