pub struct ExcelHandler { /* private fields */ }Expand description
Excel file handler
Implementations§
Source§impl ExcelHandler
impl ExcelHandler
Sourcepub fn write_with_chart(
&self,
path: &str,
data: &[Vec<String>],
chart_config: &ChartConfig,
) -> Result<()>
pub fn write_with_chart( &self, path: &str, data: &[Vec<String>], chart_config: &ChartConfig, ) -> Result<()>
Write data with an embedded chart to an XLSX file
Sourcepub fn add_chart_to_data(
&self,
data: &[Vec<String>],
chart_config: &ChartConfig,
output_path: &str,
) -> Result<()>
pub fn add_chart_to_data( &self, data: &[Vec<String>], chart_config: &ChartConfig, output_path: &str, ) -> Result<()>
Add a chart to existing data and write to an XLSX file
Source§impl ExcelHandler
impl ExcelHandler
pub fn new() -> Self
pub fn read(&self, path: &str) -> Result<String>
pub fn read_with_sheet( &self, path: &str, sheet_name: Option<&str>, ) -> Result<String>
pub fn parse_cell_reference(&self, cell: &str) -> Result<(u32, u16)>
Sourcepub fn read_range(
&self,
path: &str,
range: &CellRange,
sheet_name: Option<&str>,
) -> Result<Vec<Vec<String>>>
pub fn read_range( &self, path: &str, range: &CellRange, sheet_name: Option<&str>, ) -> Result<Vec<Vec<String>>>
Read a specific range from Excel file
Sourcepub fn read_as_json(
&self,
path: &str,
sheet_name: Option<&str>,
) -> Result<String>
pub fn read_as_json( &self, path: &str, sheet_name: Option<&str>, ) -> Result<String>
Read Excel and return as JSON array
Sourcepub fn list_sheets(&self, path: &str) -> Result<Vec<String>>
pub fn list_sheets(&self, path: &str) -> Result<Vec<String>>
Get list of sheet names in workbook (cached)
Sourcepub fn read_all_sheets(
&self,
path: &str,
) -> Result<HashMap<String, Vec<Vec<String>>>>
pub fn read_all_sheets( &self, path: &str, ) -> Result<HashMap<String, Vec<Vec<String>>>>
Read all sheets at once, returns map of sheet_name -> data
Sourcepub fn read_ods(&self, path: &str, sheet_name: Option<&str>) -> Result<String>
pub fn read_ods(&self, path: &str, sheet_name: Option<&str>) -> Result<String>
Read ODS as CSV-like string
Source§impl ExcelHandler
impl ExcelHandler
pub fn write_from_csv( &self, csv_path: &str, excel_path: &str, sheet_name: Option<&str>, ) -> Result<()>
Sourcepub fn write_styled(
&self,
path: &str,
data: &[Vec<String>],
options: &WriteOptions,
) -> Result<()>
pub fn write_styled( &self, path: &str, data: &[Vec<String>], options: &WriteOptions, ) -> Result<()>
Write data to Excel with styling options
Sourcepub fn add_sparkline_formula(
&self,
excel_path: &str,
data_range: &str,
sparkline_cell: &str,
sheet_name: Option<&str>,
) -> Result<()>
pub fn add_sparkline_formula( &self, excel_path: &str, data_range: &str, sparkline_cell: &str, sheet_name: Option<&str>, ) -> Result<()>
Add a sparkline to an Excel file
Sourcepub fn apply_conditional_format_formula(
&self,
excel_path: &str,
range: &str,
condition: &str,
true_format: &CellStyle,
_false_format: Option<&CellStyle>,
sheet_name: Option<&str>,
) -> Result<()>
pub fn apply_conditional_format_formula( &self, excel_path: &str, range: &str, condition: &str, true_format: &CellStyle, _false_format: Option<&CellStyle>, sheet_name: Option<&str>, ) -> Result<()>
Apply conditional formatting to an Excel file
Trait Implementations§
Source§impl DataReader for ExcelHandler
impl DataReader for ExcelHandler
Source§fn read_with_headers(&self, path: &str) -> Result<Vec<Vec<String>>>
fn read_with_headers(&self, path: &str) -> Result<Vec<Vec<String>>>
Read data with headers (first row contains column names)
Source§fn read_range(&self, path: &str, range: &CellRange) -> Result<Vec<Vec<String>>>
fn read_range(&self, path: &str, range: &CellRange) -> Result<Vec<Vec<String>>>
Read a specific cell range from a file
Source§fn supports_format(&self, path: &str) -> bool
fn supports_format(&self, path: &str) -> bool
Check if the file format is supported
Source§impl DataWriter for ExcelHandler
impl DataWriter for ExcelHandler
Source§fn write(
&self,
path: &str,
data: &[Vec<String>],
options: DataWriteOptions,
) -> Result<()>
fn write( &self, path: &str, data: &[Vec<String>], options: DataWriteOptions, ) -> Result<()>
Write data to a file
Source§fn write_range(
&self,
path: &str,
data: &[Vec<String>],
start_row: usize,
start_col: usize,
) -> Result<()>
fn write_range( &self, path: &str, data: &[Vec<String>], start_row: usize, start_col: usize, ) -> Result<()>
Write data to a specific cell range
Source§fn append(&self, path: &str, data: &[Vec<String>]) -> Result<()>
fn append(&self, path: &str, data: &[Vec<String>]) -> Result<()>
Append data to an existing file
Source§fn supports_format(&self, path: &str) -> bool
fn supports_format(&self, path: &str) -> bool
Check if the file format is supported
Auto Trait Implementations§
impl Freeze for ExcelHandler
impl RefUnwindSafe for ExcelHandler
impl Send for ExcelHandler
impl Sync for ExcelHandler
impl Unpin for ExcelHandler
impl UnsafeUnpin for ExcelHandler
impl UnwindSafe for ExcelHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more