Created
August 31, 2012 21:04
-
-
Save demimismo/3558968 to your computer and use it in GitHub Desktop.
Combine multiple sheets on xls into a single csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'roo' | |
require 'iconv' | |
oo = Excel.new("data.xls") | |
CSV.open("export.csv", "wb") do |csv| | |
oo.sheets.each do |s| | |
oo.default_sheet = s | |
2.upto(oo.last_row) do |i| | |
csv << (1..6).map {|j| oo.cell(i, j)} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment