Well, yeah...
You're telling it to put each stat in a new row.
Code:
CSV.open("losol.csv", "wb") do |row|
row << ["stat"]
(0..stats.length - 1).each do |index|
row << [stats[index]]
You either need to create an array of arrays with each array containing the stats of each individual player (or line) or create a loop that iterates through the stats by the number of stats per player. In other words, something like this...
Code:
NUMBER_OF_STATS_PER_PLAYER = 18
NUMBER_OF_PLAYERS = stats.length / NUMBER_OF_STATS_PER_PLAYER
for i in (0..NUMBER_OF_PLAYERS - 1)
a = i * NUMBER_OF_STATS_PER_PLAYER
row << [stats[a]] + [stats[a + 1]] + [stats[a + 2]].... + [stats[a + NUMBER_OF_STATS_PER_PLAYER - 1]]
end
Why are you using Ruby if you're just parsing for Excel anyway?