Export to csv only if query is not empty

I have a server action, and it contains 2 steps:

the export CSV file get’s it data from the databasse query.

Now I wonder, is it possible to export to a csv file only when the query has results (= not empty)?

Community Page
Last updated: