Stop excel Export if no Records

I set up my Excel exports using Grid with Initial Module set to be Excel.
When I go to Export, if there are no records it still creates an empty Excel spreadsheet to download.
Any code I place on the OnScriptInit or OnApplicationInit events gets ignored.

Is there a way to prevent it from generating a spreadsheet if there are no records?

you can place a blank app before the grid that redirect to the grid when records exist or else shows a message

2 Likes