excel2csv-bin 0.1.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/excel2csv +39 -0
  3. metadata +59 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f32777eae28cc5ed58d11326351e0b9ed80c0661
4
+ data.tar.gz: ce016b573d9a6578b78e1ef0f39c98f4941dbbbf
5
+ SHA512:
6
+ metadata.gz: 8d9a9349cbebda14c2c4016d3c0647630166d535c83b73fa3ab8c38d269b36e20922ddddfcbabbc200f34823b4c49d179a7e04d0d1fe141b4a9ccfc3dd9152d6
7
+ data.tar.gz: c0be9c5d6a712b7560e0934931a9ddc2a8f25c2871851bfb90d06757c3508ac30ca90f34f1d16fe3e54ea4fe0583192484665a7e98dc5011bddb9e2843ee273b
data/bin/excel2csv ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'roo'
5
+ require 'csv'
6
+
7
+ USAGE = <<END
8
+ Convert an excel file to csv via the roo library
9
+
10
+ Example usage:
11
+ # Print the csv to std out
12
+ excel2csv file.xls
13
+
14
+ # Write the csv to file
15
+ excel2csv file.xls out.csv
16
+
17
+ END
18
+
19
+ def die_with_usage(msg = nil)
20
+ puts USAGE
21
+ puts msg if msg
22
+ exit
23
+ end
24
+
25
+ filename = ARGV[0]
26
+
27
+ die_with_usage 'You must pass a file.' unless filename
28
+
29
+ if filename =~ /xlsx$/
30
+ excel = Roo::Excelx.new(filename)
31
+ else
32
+ excel = Roo::Excel.new(filename)
33
+ end
34
+
35
+ output = ARGV[1] ? File.open(ARGV[1], 'w') : STDOUT
36
+
37
+ 1.upto(excel.last_row) do |line|
38
+ output.write CSV.generate_line excel.row(line)
39
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: excel2csv-bin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen Pike
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: roo
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ description: Simple command line interface to convert .xls or .xlsx files to .csv
28
+ email: steve@scpike.net
29
+ executables:
30
+ - excel2csv
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - bin/excel2csv
35
+ homepage: https://github.com/scpike/excel2csv
36
+ licenses:
37
+ - MIT
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.6.8
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: CLI to convert .xls/.xlsx to .csv
59
+ test_files: []