I'm not familiar with roo (and at a quick glance, it doesn't seem like there are many examples to pull from), but how about:
data_row_definitions = {
:data_a => 2, # i.e. data_a is stored in row 2 for all servers
:data_b => 3,
:data_c => 4,
}
server_columns = 2.upto(xls.last_column) # or whatever columns the servers are listed
server_columns.map do |server_col|
data_for_server = Hash[
data_row_definitions.map do |data_name, row|
cell_value = xls.cell(row, server_col)
[data_name, cell_value]
end
]
end
With a table like:
| |Server 1|Server 2|Server N|
| dataA | 1| 3| 7|
| dataB | 10| 35| 14|
| dataC | 100| 95| 28|
(I would imagine) You would get the data structure:
[
{
"dataA" => 1,
"dataB" => 10,
"dataC" => 100,
},
{
"dataA" => 3,
"dataB" => 35,
"dataC" => 95,
},
{
"dataA" => 7,
"dataB" => 14,
"dataC" => 28,
},
]
And should work for however many N
servers/columns you have due to every sever/column being enumerated in the server_columns
variable.