rsv_lib/excel/
to.rs

1use crate::args::To;
2use crate::utils::cli_result::CliResult;
3use crate::utils::to::{excel_to_csv, is_valid_plain_text};
4
5impl To {
6    pub fn excel_run(&self) -> CliResult {
7        let out = self.out.to_lowercase();
8        let outsep = if out.ends_with("tsv") {
9            '\t'.to_string()
10        } else {
11            ','.to_string()
12        };
13
14        if !is_valid_plain_text(&out) {
15            let msg = format!("output file format of <{out}> is un-recognized.");
16            return Err(msg.into());
17        }
18
19        excel_to_csv(&self.path(), self.sheet, &outsep, &out)?;
20
21        Ok(())
22    }
23}