This Commented CUE demonstrates how to use the built-in function encoding/csv.Encode to encode a list of lists into a string as comma-separated values (CSV).

file.cue
package example

import "encoding/csv"

data: [
	["Id", "Name", "Location", "Species"],
	["1", "Charlie", "Ripon, North Yorkshire", "cat"],
	["2", "Fred", "San Francisco", "cat"],
	["3", "Greyfriars Bobby", "Edinburgh", "dog"],
	["4", "Nemo", "???", "fish"],
]

output: csv.Encode(data)
TERMINAL
$ cue export -e output --out text
Id,Name,Location,Species
1,Charlie,"Ripon, North Yorkshire",cat
2,Fred,San Francisco,cat
3,Greyfriars Bobby,Edinburgh,dog
4,Nemo,???,fish