How to Convert existing report to Excel CSV

Save the same code into a data export template, set a file name with directory samba has permissions to write to.
You probably need to set file type as CSV and adjust formatting on expressions to format data as csv.

Try searching the forum for examples like;