All Projects → defunkydrummer → lisp-xl

defunkydrummer / lisp-xl

Licence: MIT license
Common Lisp Microsoft XLSX (Microsoft Excel) loader for arbitrarily-sized / big-size files

Programming Languages

common lisp
692 projects

Labels

Projects that are alternatives of or similar to lisp-xl

excel-merge
A PHP library to merge two or more Excel files into one
Stars: ✭ 26 (-3.7%)
Mutual labels:  excel, xlsx
sheet2dict
Simple XLSX and CSV to dictionary converter
Stars: ✭ 206 (+662.96%)
Mutual labels:  excel, xlsx
xlsx reader
A production-ready XLSX file reader for Elixir.
Stars: ✭ 46 (+70.37%)
Mutual labels:  excel, xlsx
xlsx-js-style
SheetJS Community Edition + Basic Cell Styles
Stars: ✭ 129 (+377.78%)
Mutual labels:  excel, xlsx
spark-hadoopoffice-ds
A Spark datasource for the HadoopOffice library
Stars: ✭ 36 (+33.33%)
Mutual labels:  excel, xlsx
fxl
fxl is a Clojure spreadsheet library
Stars: ✭ 117 (+333.33%)
Mutual labels:  excel, xlsx
excelizor
A simple tool to export .xlsx files to lua-table, json and their corresponding csharp classes and golang structs
Stars: ✭ 35 (+29.63%)
Mutual labels:  excel, xlsx
xlsx-reader
xlsx-reader is a PHP library for fast and efficient reading of XLSX spreadsheet files. Its focus is on reading the data contained within XLSX files, disregarding all document styling beyond that which is strictly necessary for data type recognition. It is built to be usable for very big XLSX files in the magnitude of multiple GBs.
Stars: ✭ 40 (+48.15%)
Mutual labels:  excel, xlsx
umya-spreadsheet
A pure rust library for reading and writing spreadsheet files
Stars: ✭ 79 (+192.59%)
Mutual labels:  excel, xlsx
spreadsheet
Yii2 extension for export to Excel
Stars: ✭ 79 (+192.59%)
Mutual labels:  excel, xlsx
xltpl
A python module to generate xls/x files from a xls/x template.
Stars: ✭ 46 (+70.37%)
Mutual labels:  excel, xlsx
fxl.js
ƛ fxl.js is a data-oriented JavaScript spreadsheet library. It provides a way to build spreadsheets using modular, lego-like blocks.
Stars: ✭ 27 (+0%)
Mutual labels:  excel, xlsx
easy-excel
🚀 快速读写Excel文件,简单高效
Stars: ✭ 118 (+337.04%)
Mutual labels:  excel, xlsx
Dexiom.EPPlusExporter
A very simple, yet incredibly powerfull library to generate Excel documents out of objects, arrays, lists, collections, etc.
Stars: ✭ 19 (-29.63%)
Mutual labels:  excel, xlsx
Qxlnt
Use xlnt in Qt 5 or 6. xlnt is cross-platform user-friendly xlsx library for C++14.
Stars: ✭ 66 (+144.44%)
Mutual labels:  excel, xlsx
OpenSpreadsheet
OpenSpreadsheet provides an easy-to-use wrapper around the OpenXML spreadsheet SAX API. It specializes in efficiently reading and writing between strongly typed collections and worksheets.
Stars: ✭ 24 (-11.11%)
Mutual labels:  excel, xlsx
laravel-xlswriter
an excel export/import tool for laravel based on php-xlswriter
Stars: ✭ 54 (+100%)
Mutual labels:  excel, xlsx
xls2db
Export table data from excel to mysql database, implemented with python.
Stars: ✭ 33 (+22.22%)
Mutual labels:  excel, xlsx
eec
A fast and lower memory excel write/read tool.一个非POI底层,支持流式处理的高效且超低内存的Excel读写工具
Stars: ✭ 93 (+244.44%)
Mutual labels:  excel, xlsx
MiniExcel
Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet
Stars: ✭ 996 (+3588.89%)
Mutual labels:  excel, xlsx

lisp-xl

Common Lisp Library for working with Microsoft Excel XLSX files, for example for ETL (extract-transform-load) and data cleansing purposes. This library is geared for working with large files (i.e. 100MB excel files).

It does not load the whole file into RAM, thus, processing large files is possible. However, be careful with files that contain a lot of "unique strings" (strings that do not repeat frequently on the file), for they need to be loaded onto RAM.

NOTE: This library is still under development, API might change slightly over time.

Reason for being

In the business world, when your request a "data dump" from a customer's system, you usually want the customer to give you the data in the form of compressed, tidy CSV files. In real life, often you will get a huge XLSX files instead, where for example the first row isn't the header row, blank rows here and there, etc. In short, files that aren't ready for uplaoding... So, read the mundane Microsoft XLSX files using the celestial programming language, Common Lisp!

Features

  • Does NOT load the whole file into RAM.
  • Loads and uncompresses the XLSX sheet file only once, to save time when reading it more than once.

TODO

  • Parse numbers and dates correctly. Currently, it will not attempt to parse most numbers and dates, but return them as strings.
  • Performance improvements.

Usage

Typical process is as follows:

  1. Load the sheet, creating a struct that holds info about the sheet. For this you need the file path, and the name/index of the sheet (1 = first sheet).

  2. Query the sheet using the provided functions.

;; load lib
(ql:quickload :lisp-xl)
(in-package :lisp-xl)

(defparameter *s* (read-sheet *f* 1)) ; read first sheet of file *f*
(process-sheet *s* :max-row 100) ;; obtain some rows as cons

;; delete temp file / close sheet
(close-sheet *s*)

Another way is using the macro "With open-excel-sheet", which opens the sheet, performs a block, and then closes the sheet, thus deleting the temporary file.

(with-open-excel-sheet (*f* 1 sheet)
           ;; do stuff with 'sheet'
           ;; ...
           )

To do useful stuff, you would create a function that will process each row and do something useful with it (Each row will be received as a list of values).

 (with-open-excel-sheet (*f* 1 sheet nil)
           ;; our "useful" function that will process each row
           (flet ((f (row) 
                    (print row)))
             ;; call #'f at each row, skip first row
             (process-sheet sheet :max-row 10 :initial-row 2 :row-function #'f)))

Or you can work on all the sheets in the file. For example:

(with-all-excel-sheets (file sh index name) ;bind sheet index and name 
    (format t "~% Working on sheet ~A ~%" name)
    ;; do stuff...
    )
    

CSV Export

CSV Export is available by using lisp-xl-csv:excel-to-csv, at csv-export.lisp.

Uses

  • CXML (Closure-XML)
  • ZIP (xlsx files are zipped)
  • xmls
  • uiop
  • cl-ppcr

Caveats

The software is still work in progress, it works, but for example there are some issues:

  • See TODO.

The code itself could have been implemented in a much shorter and simple way, however with lower performance. Performance is still one of my main concerns. A current performance bottleneck is the ZIP expansion of the XLSX file. The "deflate" function used is IMO slow and could be reimplemented.

Installation

For CL newbies (welcome!):

Download lisp-xl, copy to "local-projects", then use quicklisp to load the rest of the required libs and compile:

(ql:quickload :lisp-xl)

Author

Flavio Egoavil (f_egoavil at microsoft's ancient, high temperature mail system.)

Acknowledgements

  • Functions for reading the XLSX file metadata taken from the xlsx library by Carlos Ungil.
  • Akihide Nano, for putting Carlos' library in GitHub.

For working with small XLSX files in a Cell-oriented way (i.e. "A1", "B4", etc), you might want to take a look at Carlos library: https://gitlab.common-lisp.net/cungil/xlsx

Japanese users may want to use Akihide Nano(a-nano) library which is based on Carlos Ungil's: https://github.com/a-nano/xlsx This one also includes returning the XLSX file as a-list or p-list.

License

Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].