setupxls 1.0.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/LICENSE +19 -0
- data/README.md +16 -0
- data/Rakefile +13 -0
- data/lib/setupxls/version.rb +3 -0
- data/lib/setupxls.rb +24 -0
- data/spec/setupxls_spec.rb +7 -0
- data/spec/spec_helper.rb +1 -0
- data/test/benchmark.rb +2 -0
- metadata +54 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2013
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
SetupXls
|
2
|
+
=============
|
3
|
+
|
4
|
+
SetupXls is a small class that allows you to quickly and easily link the power of ruby to Excel.
|
5
|
+
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
|
9
|
+
Install using `gem install setupxls`
|
10
|
+
|
11
|
+
x = SetupXls.new("[an open Excel workbook sheetname]")
|
12
|
+
|
13
|
+
x.cells(1,2).value = 5 #prints 5 in the worksheets range of B1.
|
14
|
+
y = x.cells(1,2).value #sets the variable y to the value in B1.
|
15
|
+
|
16
|
+
Remember it's alawys (rw, col)
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
task :default => :spec
|
5
|
+
|
6
|
+
desc "Run all examples"
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
8
|
+
t.rspec_opts = %w[--color]
|
9
|
+
end
|
10
|
+
|
11
|
+
task :benchmark do
|
12
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "/test/benchmark"))
|
13
|
+
end
|
data/lib/setupxls.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class SetupXls
|
2
|
+
require 'win32ole'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
|
6
|
+
# variable_for_sheet = SetupXls.new("one")
|
7
|
+
|
8
|
+
def self.setsheet(sheetname) #create an instance variable for a sheet
|
9
|
+
excel = WIN32OLE::connect('excel.Application')
|
10
|
+
worksheet = nil
|
11
|
+
excel.Workbooks.each{|wb|
|
12
|
+
wb.Worksheets.each{|ws|
|
13
|
+
if ws.name == sheetname
|
14
|
+
worksheet = ws
|
15
|
+
return ws
|
16
|
+
break
|
17
|
+
end
|
18
|
+
}
|
19
|
+
break unless worksheet.nil?
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
binding.pry
|
24
|
+
gets
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'setupxls'
|
data/test/benchmark.rb
ADDED
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: setupxls
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- ebb flowgo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-04-18 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! ' Setupxls allows you to connect ruby to an excel worksheet.
|
15
|
+
|
16
|
+
'
|
17
|
+
email: ebbflowgo@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- LICENSE
|
25
|
+
- lib/setupxls/version.rb
|
26
|
+
- lib/setupxls.rb
|
27
|
+
- spec/setupxls_spec.rb
|
28
|
+
- spec/spec_helper.rb
|
29
|
+
- test/benchmark.rb
|
30
|
+
homepage: http://github.com/ebbflowgo/setupxls
|
31
|
+
licenses: []
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 1.8.24
|
51
|
+
signing_key:
|
52
|
+
specification_version: 3
|
53
|
+
summary: Access an open Excel workbook worksheet.
|
54
|
+
test_files: []
|