Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mdwagner/xls.cr
Crystal bindings to libxls
https://github.com/mdwagner/xls.cr
crystal crystal-lang libxls xls
Last synced: about 1 month ago
JSON representation
Crystal bindings to libxls
- Host: GitHub
- URL: https://github.com/mdwagner/xls.cr
- Owner: mdwagner
- License: mit
- Created: 2022-06-11T19:34:23.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-31T13:25:59.000Z (over 2 years ago)
- Last Synced: 2023-03-12T00:16:36.830Z (almost 2 years ago)
- Topics: crystal, crystal-lang, libxls, xls
- Language: Crystal
- Homepage: https://mdwagner.github.io/xls.cr/
- Size: 68.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xls
Crystal bindings to [libxls](https://github.com/libxls/libxls) to read old Excel files (.xls)
## Installation
1. Install **[libxls](https://github.com/libxls/libxls)**
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
xls:
github: mdwagner/xls.cr
version: 0.4.1
```1. Run `shards install`
## Usage
```crystal
require "xls"# Simple example of usage
Xls::Spreadsheet.open(Path.new("./example.xls")) do |s|
skip_first_ws_puts = trues.worksheets.each do |ws|
puts unless skip_first_ws_puts
puts "Sheet: #{ws.name}"
skip_first_row_puts = truews.rows.each_with_index do |row, row_index|
puts unless skip_first_row_puts
puts "Row: #{row_index + 1}"row.cells.each_with_index do |cell, cell_index|
puts "Cell: #{cell_index + 1}, Value: #{cell.value}"
endskip_first_row_puts = false
endskip_first_ws_puts = false
end
end
```Look at `examples/` folder for more examples of different usage.
## Contributors
- [Michael Wagner](https://github.com/mdwagner) - creator and maintainer