Created
July 15, 2013 04:57
-
-
Save deepflame/5997605 to your computer and use it in GitHub Desktop.
This Ruby script fills in the blanks in a csv file which has "rowspan".
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 'csv' | |
FILE_IN = "in.csv" | |
FILE_OUT = "out.csv" | |
CSV.open(FILE_OUT, "wb") do |out| | |
CSV.foreach(FILE_IN) do |row| | |
@complete_row ||= row | |
row.each_with_index {|v,i| @complete_row[i] = v if v } | |
out << @complete_row | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
A file that looks like:
will be converted to: