All Projects → jsonkenl → Xlsxir

jsonkenl / Xlsxir

Licence: mit
Xlsx parser for the Elixir language.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Xlsxir

Phpspreadsheet
A pure PHP library for reading and writing spreadsheet files
Stars: ✭ 10,627 (+6263.47%)
Mutual labels:  excel, libreoffice, xlsx
Gotenberg
A Docker-powered stateless API for PDF files.
Stars: ✭ 3,272 (+1859.28%)
Mutual labels:  excel, libreoffice, xlsx
spreadsheet
Yii2 extension for export to Excel
Stars: ✭ 79 (-52.69%)
Mutual labels:  excel, libreoffice, xlsx
Filecontextcore
FileContextCore is a "Database"-Provider for Entity Framework Core and adds the ability to store information in files instead of being limited to databases.
Stars: ✭ 91 (-45.51%)
Mutual labels:  excel, xlsx
Dbwebapi
(Migrated from CodePlex) DbWebApi is a .Net library that implement an entirely generic Web API (RESTful) for HTTP clients to call database (Oracle & SQL Server) stored procedures or functions in a managed way out-of-the-box without any configuration or coding.
Stars: ✭ 84 (-49.7%)
Mutual labels:  excel, xlsx
Excelcy
Excel Integration with spaCy. Training NER using Excel/XLSX from PDF, DOCX, PPT, PNG or JPG.
Stars: ✭ 89 (-46.71%)
Mutual labels:  excel, xlsx
Fast Excel
🦉 Fast Excel import/export for Laravel
Stars: ✭ 1,183 (+608.38%)
Mutual labels:  excel, xlsx
Php xlsxwriter
Lightwight XLSX Excel Spreadsheet Writer in PHP
Stars: ✭ 1,376 (+723.95%)
Mutual labels:  excel, xlsx
Bookfx
Composing Excel spreadsheets based on a tree of nested components like the HTML DOM.
Stars: ✭ 102 (-38.92%)
Mutual labels:  excel, xlsx
Xlsx
Simple and incomplete Excel file parser/writer
Stars: ✭ 110 (-34.13%)
Mutual labels:  excel, xlsx
Xresloader
跨平台Excel导表工具(Excel=>protobuf/msgpack/lua/javascript/json/xml)
Stars: ✭ 161 (-3.59%)
Mutual labels:  excel, xlsx
Js2excel
😌 😃 👿 A simple module for excel and json converts each other, which works in the browser.
Stars: ✭ 83 (-50.3%)
Mutual labels:  excel, xlsx
Excel Io
Object-oriented java Excel library
Stars: ✭ 76 (-54.49%)
Mutual labels:  excel, xlsx
Tabtoy
高性能表格数据导出器
Stars: ✭ 1,302 (+679.64%)
Mutual labels:  excel, xlsx
Myexcel
MyExcel, a new way to operate excel!
Stars: ✭ 1,198 (+617.37%)
Mutual labels:  excel, xlsx
Xlsx
Fast and reliable way to work with Microsoft Excel™ [xlsx] files in Golang
Stars: ✭ 132 (-20.96%)
Mutual labels:  excel, xlsx
Vue Xlsx Table
Not need upload, view xlsx or xls file in your browser, Supported by js-xlsx.
Stars: ✭ 136 (-18.56%)
Mutual labels:  excel, xlsx
Writexl
Portable, light-weight data frame to xlsx exporter for R
Stars: ✭ 162 (-2.99%)
Mutual labels:  excel, xlsx
Documentbuilder
ONLYOFFICE Document Builder is powerful text, spreadsheet, presentation and PDF generating tool
Stars: ✭ 61 (-63.47%)
Mutual labels:  excel, xlsx
Excelize
Golang library for reading and writing Microsoft Excel™ (XLSX) files.
Stars: ✭ 10,286 (+6059.28%)
Mutual labels:  excel, xlsx

Xlsxir

Build Status Hex.pm Version Hex docs GitHub license

Xlsxir is an Elixir library that parses .xlsx files using Simple API for XML (SAX) parsing via the Erlsom Erlang library, extracts the data to an Erlang Term Storage (ETS) process and provides various functions for accessing the data. Please submit any issues found and they will be addressed ASAP.

Installation

You can add Xlsxir as a dependency to your Elixir project via the Hex package manager by adding the following to your mix.exs file:

def deps do
  [ {:xlsxir, "~> 1.6.4"} ]
end

Or, you can directly reference the GitHub repo:

def deps do
  [ {:xlsxir, github: "jsonkenl/xlsxir"} ]
end

Then start an OTP application:

defp application do
  [applications: [:xlsxir]]
end

Basic Usage

Xlsxir.extract/3 is deprecated, please use Xlsxir.multi_extract/1-5 going forward.

Xlsxir parses a .xlsx file located at a given path and extracts the data to an ETS process via the Xlsxir.multi_extract/1-5, Xlsxir.peek/3-4 and Xlsxir.stream_list/2-3 functions:

Xlsxir.multi_extract(path, index \\ nil, timer \\ false, excel \\ nil, options \\ [])
Xlsxir.peek(path, index, rows, options \\ [])
Xlsxir.stream_list(path, index, options \\ [])

The peek/3-4 functions return only the given number of rows from the worksheet at a given index. The multi_extract/1-5 functions allow multiple worksheets to be parsed by creating a separate ETS process for each worksheet and returning a unique table identifier for each. This option will parse all worksheets by default (when index == nil), returning a list of tuple results.

Argument descriptions:

  • path the path of the file to be parsed in string format
  • index is the position of the worksheet you wish to parse (zero-based index)
  • timer is a boolean flag that controls an extraction timer that returns time elapsed when set to true. Defalut value is false.
  • rows is an integer representing the number of rows to be extracted from the given worksheet.
  • options - see function documentation for option detail.

Upon successful completion, the extraction process returns:

  • for multi_extract/3:
    • [{:ok, table_1_id}, ...] with timer set to false
    • {:ok, table_id} when given a specific worksheet index
    • [{:ok, table_1_id, time_elapsed}, ...] with timer set to true
    • {:ok, table_id, time_elapsed} when given a specific worksheet index
  • for peek/3: {:ok, table_id}

Unsucessful parsing of a specific worksheet returns {:error, reason}.


The extracted worksheet data can be accessed using any of the following functions:
Xlsxir.get_list(table_id)
Xlsxir.get_map(table_id)
Xlsxir.get_mda(table_id)
Xlsxir.get_cell(table_id, cell_ref)
Xlsxir.get_row(table_id, row_num)
Xlsxir.get_col(table_id, col_ltr)
Xlsxir.get_info(table_id, num_type)

Xlsxir.get_list/1 returns entire worksheet in a list of row lists (i.e. [[row 1 values], ...])
Xlsxir.get_map/1 returns entire worksheet in a map of cell names and values (i.e. %{"A1" => value, ...})
Xlsxir.get_mda/1 returns entire worksheet in an indexed map which can be accessed like a multi-dimensional array (i.e. some_var[0][0] for cell "A1")
Xlsxir.get_cell/2 returns value of specified cell (i.e. "A1" returns value contained in cell A1)
Xlsxir.get_row/2 returns values of specified row (i.e. 1 returns the first row of data)
Xlsxir.get_col/2 returns values of specified column (i.e. "A" returns the first column of data)
Xlsxir.get_info/1 and Xlsxir.get_multi_info/2 return count data for num_type specified (i.e. :rows, :cols, :cells, :all)

Once the table data is no longer needed, run the following function to delete the ETS process and free memory:

Xlsxir.close(table_id)

Refer to Xlsxir documentation for more detailed examples.

Considerations

Cell references are formatted as a string (i.e. "A1"). Strings will be returned as type string, resulting values for functions from within the worksheet are returned as type string, integer or float depending on the type of the resulting value, data formatted as a number in the worksheet will be returned as type integer or float, date formatted values will be returned in Erlang :calendar.date() type format (i.e. {year, month, day}), and datetime values will be returned as an Elixir naive datetime. Xlsxir does not currently support dates prior to 1/1/1900.

Contributing

Contributions are encouraged. Feel free to fork the repo, add your code along with appropriate tests and documentation (ensuring all existing tests continue to pass) and submit a pull request.

Bug Reporting

Please report any bugs or request future enhancements via the Issues page.

Acknowledgements

I'd like to thank the following people who were a big help in the development of this library:

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