csv2xlsx 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +23 -0
- data/Rakefile +1 -0
- data/bin/csv2xlsx +6 -0
- data/csv2xlsx.gemspec +26 -0
- data/lib/csv2xlsx.rb +22 -0
- data/lib/csv2xlsx/version.rb +3 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d549bfb83488b6cb83226424d7adea0065c3c350
|
4
|
+
data.tar.gz: 56c55e51fba332ff9feb7986cb0ab291eff74967
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f23d3069accfa9f9681cc568992edb4eb5dfd5017fc7ad142ae73b673ef3ac98656c24c2da3a283de6fe0be2b56daf3fdd39b9c9b016f31a0594613a1ccb9a1f
|
7
|
+
data.tar.gz: 783d7fb722355d29d62bc4260b80ca9cfb9d0ae9eaac28d5b4752f87dc2452db80620af28671c6b479e25708ba43b87524e5c3aff06b0445a73b944bc2fe1d11
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Ryan Duryea
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
csv2xlsx
|
2
|
+
========
|
3
|
+
|
4
|
+
Take your CSVs and shove 'em!...into an Excel file...
|
5
|
+
|
6
|
+
### Usage
|
7
|
+
|
8
|
+
```
|
9
|
+
csv2xlsxl new_excel_file.xlsx file1.csv file2.csv [...]
|
10
|
+
```
|
11
|
+
|
12
|
+
This creates an Excel file called `new_excel_file.xlsx` with each CSV file's contents in its own sheet. The sheets are named the same as the CSV filename, e.g. the first sheet is named `file1`.
|
13
|
+
|
14
|
+
### Thanks To axlsx
|
15
|
+
|
16
|
+
All I did was wrap a loop around this awesome library: http://github.com/randym/axlsx
|
17
|
+
|
18
|
+
### Copyright and License
|
19
|
+
|
20
|
+
Copyright (c) 2013, Ryan Duryea.
|
21
|
+
|
22
|
+
This project is licensed under the [MIT License](LICENSE).
|
23
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/csv2xlsx
ADDED
data/csv2xlsx.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'csv2xlsx/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "csv2xlsx"
|
8
|
+
spec.version = Csv2Xlsx::VERSION
|
9
|
+
spec.authors = ["Ryan Duryea"]
|
10
|
+
spec.email = ["aguynamedryan@gmail.com"]
|
11
|
+
spec.description = 'Creates an Excel file from one or more CSV files, one sheet per file'
|
12
|
+
spec.summary = 'Create an Excel file from one or more CSV files'
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.required_ruby_version = '>= 1.8.7'
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_dependency "axlsx"
|
26
|
+
end
|
data/lib/csv2xlsx.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "csv2xlsx/version"
|
2
|
+
require 'csv'
|
3
|
+
require 'axlsx'
|
4
|
+
|
5
|
+
module Csv2Xlsx
|
6
|
+
def run(args)
|
7
|
+
dest = args.shift
|
8
|
+
p = Axlsx::Package.new
|
9
|
+
wb = p.workbook
|
10
|
+
args.each do |csv_file|
|
11
|
+
sheet_name = File.basename(csv_file, File.extname(csv_file))
|
12
|
+
wb.add_worksheet(name: sheet_name) do |sheet|
|
13
|
+
CSV.foreach(csv_file) do |row|
|
14
|
+
sheet.add_row row
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
p.serialize(dest)
|
19
|
+
end
|
20
|
+
|
21
|
+
module_function :run
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: csv2xlsx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Duryea
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: axlsx
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Creates an Excel file from one or more CSV files, one sheet per file
|
70
|
+
email:
|
71
|
+
- aguynamedryan@gmail.com
|
72
|
+
executables:
|
73
|
+
- csv2xlsx
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/csv2xlsx
|
83
|
+
- csv2xlsx.gemspec
|
84
|
+
- lib/csv2xlsx.rb
|
85
|
+
- lib/csv2xlsx/version.rb
|
86
|
+
homepage: ''
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.8.7
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.0.3
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Create an Excel file from one or more CSV files
|
110
|
+
test_files: []
|