There's no direct method to not produce the Excel file, however, you could utilize the File_1_RCOUNT variable that gets produced after the query has run. (see attached task file that demonstrates this).
Using the File_1_RCOUNT value add an 'if condition' activity and test the value of File_1_RCOUNT. If it's > 0 then additional activities can be added, such as email etc. If it's = 0 then use 'delete file' activity.
A video that demonstrates the IF Condition activity can be found here