我有一个数组数组,例如:
arr_all = [arr_1, arr_2, arr_3, arr_r]
在哪里:
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 = ...
我有一个文件要修改。我知道如何将数组添加为一行,但我需要帮助将每个数组插入@@ar_data
为列。我找到Row
要插入数据的,然后我想arr_1
在单元格中插入(next_empty_row, B)
,然后arr_2
在(next_empty_row, C)
,等等。请指教。填充数据的行数是每个数组的大小。arr_1
, arr_2
,arr_3
大小为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)