write_csv

Function write_csv 

Source
pub fn write_csv(
    file_path: &str,
    headers: &[&str],
    rows: &[Vec<String>],
) -> Result<()>
Expand description

Write data to CSV file

§Arguments

  • file_path - Output file path
  • headers - CSV column headers
  • rows - Data rows

§Examples

use celers_cli::command_utils::write_csv;

let headers = vec!["Name", "Count"];
let rows = vec![
    vec!["Tasks".to_string(), "100".to_string()],
    vec!["Workers".to_string(), "5".to_string()],
];
write_csv("report.csv", &headers, &rows)?;