Skip to main content

ExcelHandler

Struct ExcelHandler 

Source
pub struct ExcelHandler { /* private fields */ }
Expand description

Excel file handler

Implementations§

Source§

impl ExcelHandler

Source

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

Source

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

Source

pub fn new() -> Self

Source

pub fn read(&self, path: &str) -> Result<String>

Source

pub fn read_with_sheet( &self, path: &str, sheet_name: Option<&str>, ) -> Result<String>

Source

pub fn parse_cell_reference(&self, cell: &str) -> Result<(u32, u16)>

Source

pub fn read_range( &self, path: &str, range: &CellRange, sheet_name: Option<&str>, ) -> Result<Vec<Vec<String>>>

Read a specific range from Excel file

Source

pub fn read_as_json( &self, path: &str, sheet_name: Option<&str>, ) -> Result<String>

Read Excel and return as JSON array

Source

pub fn list_sheets(&self, path: &str) -> Result<Vec<String>>

Get list of sheet names in workbook (cached)

Source

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

Source

pub fn read_ods(&self, path: &str, sheet_name: Option<&str>) -> Result<String>

Read ODS as CSV-like string

Source

pub fn read_ods_data( &self, path: &str, sheet_name: Option<&str>, ) -> Result<Vec<Vec<String>>>

Read ODS into Vec<Vec<String>>

Source

pub fn list_ods_sheets(&self, path: &str) -> Result<Vec<String>>

List sheets in ODS file

Source

pub fn read_auto( &self, path: &str, sheet_or_range: Option<&str>, ) -> Result<Vec<Vec<String>>>

Auto-detect format (XLSX/XLS/ODS) and read into Vec<Vec<String>>

Source§

impl ExcelHandler

Source

pub fn write_from_csv( &self, csv_path: &str, excel_path: &str, sheet_name: Option<&str>, ) -> Result<()>

Source

pub fn write_styled( &self, path: &str, data: &[Vec<String>], options: &WriteOptions, ) -> Result<()>

Write data to Excel with styling options

Source

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

Source

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

Source

pub fn write_range( &self, path: &str, data: &[Vec<String>], start_row: u32, start_col: u16, sheet_name: Option<&str>, ) -> Result<()>

Write data to a specific range in Excel starting at the given row and column

Source

pub fn write_range_with_mode( &self, path: &str, data: &[Vec<String>], start_row: u32, start_col: u16, sheet_name: Option<&str>, mode: WriteMode, ) -> Result<()>

Write data to a specific range with specified write mode

Trait Implementations§

Source§

impl DataReader for ExcelHandler

Source§

fn read(&self, path: &str) -> Result<Vec<Vec<String>>>

Read all data from a file
Source§

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>>>

Read a specific cell range from a file
Source§

fn read_as_json(&self, path: &str) -> Result<String>

Read data as JSON string
Source§

fn supports_format(&self, path: &str) -> bool

Check if the file format is supported
Source§

impl DataWriter for ExcelHandler

Source§

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<()>

Write data to a specific cell range
Source§

fn append(&self, path: &str, data: &[Vec<String>]) -> Result<()>

Append data to an existing file
Source§

fn supports_format(&self, path: &str) -> bool

Check if the file format is supported

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,