Skip to content

Instantly share code, notes, and snippets.

@mainyaa
Last active November 16, 2015 11:31
Show Gist options
  • Save mainyaa/13057ff16cdaf808429a to your computer and use it in GitHub Desktop.
Save mainyaa/13057ff16cdaf808429a to your computer and use it in GitHub Desktop.
xls2csv.rb

xls2csv

Installation:

`gem install roo-xls`

Usage

`ruby xls2csv.rb ~/Downloads/hoge.xls`
#!/usr/bin/env ruby
# cording: utf-8
require 'roo-xls'
filename = ARGV[0]
xls = Roo::Excel.new(filename)
xls.sheets.map do |name|
puts "write: " + filename + "-" + name + ".csv"
File.write(filename + "-" + name + ".csv", xls.sheet(name).to_csv)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment