Crate libxcsv

Crate libxcsv 

Source

Structs§

CellRef
A cell reference in the form of column and row index
SheetInfo
Information about a sheet in the workbook name: The name of the sheet path_in_zip: The path to the sheet XML inside the zip archive
StyleInfo
Information about a cell style

Functions§

col_to_index
Convert a column string (e.g., “A”, “AB”) to a 1-based index Examples: “A” -> 1 “Z” -> 26 “AA” -> 27 “AB” -> 28
excel_serial_to_iso_date
Convert an Excel serial date to an ISO 8601 date string (UTC) If is_1904 is true, use the 1904 date system; otherwise, use the 1900 date system. Returns None if the serial number is invalid. Examples: excel_serial_to_iso_date(44197.0, false) -> Some(“2021-01-01T00:00:00.000Z”) excel_serial_to_iso_date(0.0, false) -> Some(“1899-12-30T00:00:00.000Z”) excel_serial_to_iso_date(1.0, false) -> Some(“1899-12-31T00:00:00.000Z”) excel_serial_to_iso_date(60.0, false) -> Some(“1900-02-29T00:00:00.000Z”) // Excel bug
export_sheet_xml_to_csv
Export a sheet XML to CSV file reader: BufRead of the sheet XML shared_strings: slice of shared strings styles: slice of StyleInfo is_1904: whether the workbook uses the 1904 date system out_path: path to output CSV file delimiter: CSV delimiter character (e.g., b’,’ or b’;’) Returns Result<()>
open_zip
Open the XLSX file as a ZipArchive Returns a new ZipArchive<BufReader>
parse_cell_ref
Parse a cell reference string (e.g., “A1”, “BC23”) into a CellRef struct Returns None if the input is invalid
parse_styles
Parse the styles.xml to extract cell styles and identify date formats Returns a vector of StyleInfo
parse_workbook
Parse the workbook itself Returns a vector of SheetInfo and a boolean indicating if the 1904 date system is used
parse_workbook_rels
Parse the workbook rels to make sure to find what sheet matches what data and the cell matching per row and sheet.
read_shared_strings
Read the shared strings from the excel file Returns a vector of strings
to_lowercase_filename
Convert a sheet name to a lowercase filename-safe string Non-alphanumeric characters are replaced with underscores. If the resulting string is empty, “sheet” is returned. Examples: “Sheet1” -> “sheet1” “Data-Set_2024” -> “data-set_2024” “!!!” -> “sheet” “Sales Data (Q1)” -> “sales_data__q1_”