package xlsx2csv

  1. Overview
  2. Docs
Simple library to export .xlsx files as CSVs

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.2.tar.gz
md5=b5ca6e00caa7369caae5ab5a108afc40
sha512=cdcb84b4d744747c3468493597d8a34996a482ae774cdb3229fc5f1d9663c1f12b6ddc9c5e787cd2536e914dfbd806466e7dc4e874873c5303788e02e3122729

Description

Simple library to export .xlsx files as CSVs

Tags

convert xlsx csv

Published: 11 Oct 2024

README

xlsx2csv

Simple library to export .xlsx files as CSVs

Basic usage

File into a list of strings:

let csvs = Xlsx2csv.convert ~into:`Strings "/path/to/your/excel_file.xlsx" in
match csvs with
| Ok (`Strings lst) ->
    List.iteri
      (fun i r ->
        let d = Format.dprintf "Sheet %d" (i + 1) in
        match r with
        | Ok str -> Format.printf "%t:@.%s@.@." d str
        | Error (`Msg msg) -> Format.printf "ERROR %t:@.%s@.@." d msg)
      lst
| Error (`Msg msg) -> failwith msg
| _ -> assert false

File into more files:

let files =
  Xlsx2csv.convert
    ~enc:(Some `UTF_16)
    ~ignore_hiddens:true
    ~into:(`Files ("/path/to/output/folder", "file_name"))
    "/path/to/your/excel_file.xlsx"
in
match files with
| Ok (`Files lst) ->
    List.iteri
      (fun i r ->
        let d = Format.dprintf "Sheet %d" (i + 1) in
        match r with
        | Ok () -> Format.printf "%t:@.OK@.@." d
        | Error (`Msg msg) -> Format.printf "ERROR %t:@.%s@.@." d msg)
      lst
| Error (`Msg msg) -> failwith msg
| _ -> assert false

Dependencies (7)

  1. fpath
  2. lwt
  3. uutf
  4. xmlm
  5. camlzip
  6. dune >= "3.15"
  7. ocaml >= "4.13"

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.