excelinator 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -1
- data/lib/excelinator/version.rb +2 -2
- data/lib/excelinator/xls.rb +18 -0
- metadata +25 -11
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -29,6 +29,11 @@ Call `Excelinator.csv_to_xls(csv_content)`. The csv_content will be parsed by
|
|
29
29
|
FasterCSV and converted to Excel spreadsheet contents ready to be saved to
|
30
30
|
file or sent across the wire.
|
31
31
|
|
32
|
+
If you have a lot of CSV content and don't want to do all of this work in
|
33
|
+
memory, call `Excelinator.csv_to_xls_file(csv_path, file)`, passing the path to
|
34
|
+
the CSV file and a path to the .xls file you'd like the workbook saved to.
|
35
|
+
(contributed by [maxwell](https://github.com/maxwell))
|
36
|
+
|
32
37
|
###HTML
|
33
38
|
|
34
39
|
Call `Excelinator.html_as_xls(html_content)`. The table element from the HTML
|
@@ -151,4 +156,4 @@ CHANGELOG
|
|
151
156
|
---------
|
152
157
|
####1.1.0
|
153
158
|
|
154
|
-
Added Ruby 1.9 support.
|
159
|
+
Added Ruby 1.9 support.
|
data/lib/excelinator/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Excelinator
|
2
|
-
VERSION = '1.
|
3
|
-
end
|
2
|
+
VERSION = '1.3.0'
|
3
|
+
end
|
data/lib/excelinator/xls.rb
CHANGED
@@ -21,6 +21,24 @@ def self.csv_to_xls(csv_content)
|
|
21
21
|
book.write(ios)
|
22
22
|
content
|
23
23
|
end
|
24
|
+
|
25
|
+
#memory ftw
|
26
|
+
def self.csv_to_xls_file(csv_path, file)
|
27
|
+
book = Spreadsheet::Workbook.new
|
28
|
+
sheet = book.create_worksheet
|
29
|
+
|
30
|
+
CSV.open(csv_path) do |csv|
|
31
|
+
index = 0
|
32
|
+
csv.each do |raw_row|
|
33
|
+
row = sheet.row(index)
|
34
|
+
row.push(*raw_row)
|
35
|
+
index +=1
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
book.write(file)
|
40
|
+
file
|
41
|
+
end
|
24
42
|
|
25
43
|
# This only strips a <table> out of the html and adds a meta tag for utf-8 support. Excel will open an .xls file
|
26
44
|
# with this content and grok it correctly (including formatting); however, many alternate spreadsheet applications
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excelinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- chrismo
|
@@ -9,11 +10,12 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2014-
|
13
|
+
date: 2014-10-10 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: spreadsheet
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
20
|
- - '='
|
19
21
|
- !ruby/object:Gem::Version
|
@@ -21,6 +23,7 @@ dependencies:
|
|
21
23
|
type: :runtime
|
22
24
|
prerelease: false
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
24
27
|
requirements:
|
25
28
|
- - '='
|
26
29
|
- !ruby/object:Gem::Version
|
@@ -28,29 +31,33 @@ dependencies:
|
|
28
31
|
- !ruby/object:Gem::Dependency
|
29
32
|
name: rake
|
30
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
31
35
|
requirements:
|
32
|
-
- - '>='
|
36
|
+
- - ! '>='
|
33
37
|
- !ruby/object:Gem::Version
|
34
38
|
version: '0'
|
35
39
|
type: :development
|
36
40
|
prerelease: false
|
37
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
38
43
|
requirements:
|
39
|
-
- - '>='
|
44
|
+
- - ! '>='
|
40
45
|
- !ruby/object:Gem::Version
|
41
46
|
version: '0'
|
42
47
|
- !ruby/object:Gem::Dependency
|
43
48
|
name: rspec
|
44
49
|
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
45
51
|
requirements:
|
46
|
-
- - '>='
|
52
|
+
- - ! '>='
|
47
53
|
- !ruby/object:Gem::Version
|
48
54
|
version: '0'
|
49
55
|
type: :development
|
50
56
|
prerelease: false
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
52
59
|
requirements:
|
53
|
-
- - '>='
|
60
|
+
- - ! '>='
|
54
61
|
- !ruby/object:Gem::Version
|
55
62
|
version: '0'
|
56
63
|
description: convert your csv data and html tables to excel data
|
@@ -68,25 +75,32 @@ files:
|
|
68
75
|
- lib/excelinator/xls.rb
|
69
76
|
homepage: https://github.com/livingsocial/excelinator
|
70
77
|
licenses: []
|
71
|
-
metadata: {}
|
72
78
|
post_install_message:
|
73
79
|
rdoc_options: []
|
74
80
|
require_paths:
|
75
81
|
- lib
|
76
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
77
84
|
requirements:
|
78
|
-
- - '>='
|
85
|
+
- - ! '>='
|
79
86
|
- !ruby/object:Gem::Version
|
80
87
|
version: '0'
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
hash: 2637605060163655214
|
81
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
82
93
|
requirements:
|
83
|
-
- - '>='
|
94
|
+
- - ! '>='
|
84
95
|
- !ruby/object:Gem::Version
|
85
96
|
version: '0'
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
hash: 2637605060163655214
|
86
100
|
requirements: []
|
87
101
|
rubyforge_project:
|
88
|
-
rubygems_version:
|
102
|
+
rubygems_version: 1.8.23
|
89
103
|
signing_key:
|
90
|
-
specification_version:
|
104
|
+
specification_version: 3
|
91
105
|
summary: Excel Converter
|
92
106
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: bafff62f5df22e34c98309cfccc8dc024f3211d0
|
4
|
-
data.tar.gz: 51afb010284703dd28f1a9bdfa64087aa0e0e42a
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 503beaa7aa22824725d7d38b643d7a88a6c8dfe130d5d2a066d3f813f4c1edd9a5f4f34cb46ba4f9f746e6da115890ae21087a4f4c37713ff047c40f9ddd595d
|
7
|
-
data.tar.gz: 7f2d06e888baf65ddc8bcfa1cf630db14ae092eb1d27649b725df43776fc9a86b63a78fdb15a6b3a84215e1d265de4226b71b7ea9e35c5b302b30e7eb47f92e1
|