-1
루비의 스프레드 시트 젬을 사용하여 Excel에서 데이터를 추출하는 중입니다. 이것은 코드입니다루비의 스프레드 시트 gem을 사용하여 Excel로 데이터를 다시 인쇄하는 방법
require 'spreadsheet'
require 'open-uri'
url = "Linio_batch1_semantic_24092014.xls"
book = nil
a1 = Array.new
a2 = Array.new
open url do |f|
book = Spreadsheet.open f
end
book.worksheets.each do |sheet|
#puts "Sheet called #{sheet.name} has #{sheet.row_count} rows and #{sheet.column_count} columns"
s = sheet.column(5)
s.each do |m|
a1 << m
end
s = sheet.column(6)
s.each do |n|
a2 << n
end
end
결과를 배열에 저장하고 있습니다. 다른 새로운 스프레드 시트에 결과를 쓰는 방법을 모르겠습니다. 배열 결과를 새 스프레드 시트에 쓰려면 도움이 필요합니다.