The CSV format is text format where columns are delimited by comma (https://en.wikipedia.org/wiki/Comma-separated_values).
The code you shared should generate a file. I expect there is another activity that sends the file by email.
Can you share the attachment from that email?
I still do not understand what is not working.
😞
Regards
Zdeněk Pala