rubyexcel 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubyexcel/excel_tools.rb +10 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75b8ea393ff09d58583bf303db48f20701f1497a
4
- data.tar.gz: 4ff035e0b2044679f01e555954e584654b3d199c
3
+ metadata.gz: 80bb23913c3b7ba62ca2aa77d5790e24a8dc610b
4
+ data.tar.gz: c1ff697b448df786dfb8f29cf6c3f43f37f8e6ce
5
5
  SHA512:
6
- metadata.gz: c5f31688394d7a8ea42142736bb2768019c5850af22da19ca4b1e1bd7e327f74e7a94a8fb9dc3cc6b9be8540eb86ebc36328a294fc9b28ef9b65e5a545c1ae40
7
- data.tar.gz: 3eb3b05e1913bc75ef784b46f61100358528119e50511dc20f5b62375ead84106839ab05761920813419615fae6186f5d77cbfb4fe561d490dc24e917bbd402b
6
+ metadata.gz: da3bd961b2bed9df6cc63bbf8604ada00d19dd509c0e1afe9fd0178adfd63fa4ea5a8fe594464b589c5a9e2af60c6209e9f08a38d597a3275d2352c574262b0c
7
+ data.tar.gz: f5fbdd7e132b5c2b87f88a3a45904f33346c2f1047a07a6939a292d9b64da31eda73a2bf6d11965b4373e2465a58ce3e667eb377c15266db182dc89252b35d0d
@@ -123,10 +123,11 @@ module RubyExcel
123
123
  # Filename
124
124
  File.exists?( other ) || fail( ArgumentError, "Unable to find file: #{ other }" )
125
125
 
126
- #Open the file with Excel
126
+ #Open Excel
127
127
  excel = WIN32OLE.new( 'excel.application' )
128
128
  excel.displayalerts = false
129
129
 
130
+ # Open the file
130
131
  begin
131
132
  wb = excel.workbooks.open({'filename'=> other, 'readOnly' => true})
132
133
  rescue WIN32OLERuntimeError
@@ -136,10 +137,14 @@ module RubyExcel
136
137
 
137
138
  # Only one sheet, or the entire Workbook?
138
139
  if sheetname
140
+
139
141
  add( sheetname ).load( wb.sheets( sheetname ).usedrange.send( operation ) )
142
+
140
143
  else
144
+
141
145
  self.name = File.basename( other, '.*' )
142
- wb.sheets.each { |sh| add( sh.name ).load( sh.usedrange.send( operation ) ) }
146
+ wb.sheets.each { |sh| add( sh.name ).tap{ |s| s.load( sh.usedrange.send( operation ) ) unless sh.application.worksheetfunction.counta(sh.cells).zero? } }
147
+
143
148
  end
144
149
 
145
150
  # Cleanup
@@ -156,16 +161,16 @@ module RubyExcel
156
161
 
157
162
  # Only one sheet, or the entire Workbook?
158
163
  if sheetname
159
- add( sheetname ).load( other.sheets( sheetname ).usedrange.send( operation ) )
164
+ add( sheetname ).tap{ |s| s.load( sh.usedrange.send( operation ) ) unless sh.application.worksheetfunction.counta(sh.cells).zero? }
160
165
  else
161
166
  self.name = File.basename( other.name, '.*' )
162
- other.sheets.each { |sh| add( sh.name ).load( sh.usedrange.send( operation ) ) }
167
+ other.sheets.each { |sh| add( sh.name ).tap{ |s| s.load( sh.usedrange.send( operation ) ) unless sh.application.worksheetfunction.counta(sh.cells).zero? } }
163
168
  end
164
169
 
165
170
  elsif other.ole_respond_to?( :usedrange )
166
171
 
167
172
  # Sheet
168
- add( other.name ).load( other.usedrange.send( operation ) )
173
+ add( other.name ).tap{ |s| s.load( sh.usedrange.send( operation ) ) unless sh.application.worksheetfunction.counta(sh.cells).zero? }
169
174
 
170
175
  else
171
176
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyexcel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Pearson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-20 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A tabular data structure in Ruby, with header-based helper methods for
14
14
  analysis and editing, and some of Excel's API style. Can output as 2D Array, HTML