I have an array of arrays like:
arr_all = [arr_1, arr_2, arr_3, arr_r]
where:
arr_1 = [2015-08-19 17:30:24 -0700, 2015-08-19 17:30:34 -0700, 2015-08-19 17:30:55 -0700]
arr_2 = ...
arr_3 = ...
I have a file to modify. I know how to add an array as a row, but I need help to insert each of the arrays in @@ar_data
as columns. I find the Row
to insert the data, and then I want to insert arr_1
in the cell (next_empty_row, B)
, then arr_2
at (next_empty_row, C)
, etc. Please advice. The Number of rows to fill the data is the size of each array. arr_1
, arr_2
, arr_3
are of size 3
.
def performance_report
Spreadsheet.client_encoding = 'UTF-8'
f = "PerformanceTest_S.xls"
if File.exist? (f)
# Open the previously created Workbook
book = Spreadsheet.open(f)
sheet_1_row_index = book.worksheet(0).last_row_index + 1
sheet_2_row_index = book.worksheet(1).last_row_index + 1
# Indicate the row index to the user
print "Inserting new row at index: #{sheet_2_row_index}\n"
# Insert array as column - I need help with the below code to insert data in arr_data which is array of arrays.
column = 1
row
@@ar_data.each do |time|
len = time.size
book.worksheet(0).cell(sheet_1_row_index, )
book.worksheet(0).Column.size
end
# This insert row is for worksheet 2 and works fine.
book.worksheet(1).insert_row(sheet_2_row_index, @@ar_calc)
# Delete the file so that it can be re-written
File.delete(f)
# puts @@ar_calc
# Write out the Workbook again
book.write(f)