CSV export in a custom process

Hello 

I want to create a custom process based on a daily schedule. This process is based on a SQL Query, i want the results of the SQL Query exported in a CSV file and then send by mail. 

My question is : should i creat a script that generate a CSV file and in my process step call the script or is there any native module such as script component-CSV export that will do the trick.

All help is welcome

Pierre-Louis