spreadsheet_stream_reader 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -5
- data/lib/spreadsheet_stream_reader/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4645b2f23a11e836905f2d3d93aa797081a10498
|
4
|
+
data.tar.gz: 0408bb2f3731df578dead03a427d3ad8b54e04da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 070deb75a3c3986701de43609dd34aecad083eecb37d0c94910c28f2791778f74a16a7c88ce7a1f7c3a93defa7e4ac7ede320410ae87b2b0caf7dad1d0468e30
|
7
|
+
data.tar.gz: cd699ac31811b634d1aa8eb1afca045262473b806d281961b378c1dc18c792bb2058d1a45e43c9b5d89c7834e6aa49def74927a5ad1991a8abc960f51c9f9635
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# SpreadsheetStreamReader
|
2
2
|
|
3
|
-
|
3
|
+
Memory efficient spreadsheet reader. It reads file in streaming fashion. Currently supports Excel legacy file (.xls) format. Work in progress for other file formats.
|
4
4
|
|
5
|
-
|
5
|
+
You can configure the batch size. It will read and streams the batch size rows at a time.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,7 +22,50 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
#### Opening a spreadsheet
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'spreadsheet_stream_reader'
|
29
|
+
|
30
|
+
records_per_batch = 100 #By default its 1000. You will get this much records at a time.
|
31
|
+
|
32
|
+
document = SpreadsheetStreamReader::Reader.new('/path/to/workbook.xls', records_per_batch)
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Working with sheets
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
# Returns an array of names of sheets present in the workbook
|
39
|
+
document.sheet_names
|
40
|
+
# => ["K-Sheet-1", "K-Sheet-22"]
|
41
|
+
|
42
|
+
|
43
|
+
## Access the sheet
|
44
|
+
# By name
|
45
|
+
sheet1 = document.get_sheet('K-Sheet-1')
|
46
|
+
# By index
|
47
|
+
sheet2 = document.get_sheet(1)
|
48
|
+
|
49
|
+
# => Returns the SpreadsheetStreamReader::Sheet object
|
50
|
+
```
|
51
|
+
|
52
|
+
#### Iterate through single sheet
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
sheet1.stream_rows_in_batch do |row|
|
56
|
+
puts row #Work with the row data
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
#### Iterate through workbook (all sheets in workbook)
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
document.each_sheet do |sheet|
|
64
|
+
sheet.stream_rows_in_batch do |row|
|
65
|
+
puts row #Work with the row data
|
66
|
+
end
|
67
|
+
end
|
68
|
+
```
|
26
69
|
|
27
70
|
## Development
|
28
71
|
|
@@ -32,7 +75,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
75
|
|
33
76
|
## Contributing
|
34
77
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
78
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ketandoshi/spreadsheet-stream-reader. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
79
|
|
37
80
|
## License
|
38
81
|
|
@@ -40,4 +83,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
40
83
|
|
41
84
|
## Code of Conduct
|
42
85
|
|
43
|
-
Everyone interacting in the SpreadsheetStreamReader project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
86
|
+
Everyone interacting in the SpreadsheetStreamReader project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ketandoshi/spreadsheet-stream-reader/blob/master/CODE_OF_CONDUCT.md).
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreadsheet_stream_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ketan Doshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|