Prepended CSV header lines with "# " and use CSV library's generate method to generate the header string.