This is one of the ways we can spool the output of a query into a .csv file.
set colsep , -- To separate columns with a comma
set pagesize 0 -- only one header row
set trimspool on -- To remove trailing blanks
set linesize 1000 -- It should be the sum of the column widths
set echo off -- Incase you have it on.
set feedback off -- To prevent any feedback rows int he output file.
spool test.csv
select *
from all_users;
spool off