Skip to content

Instantly share code, notes, and snippets.

@jun66j5
Created February 9, 2011 03:18
Show Gist options
  • Save jun66j5/817825 to your computer and use it in GitHub Desktop.
Save jun66j5/817825 to your computer and use it in GitHub Desktop.
#coding: utf-8
# 238.36137 secs => 28.875 secs
require 'win32ole'
xl = WIN32OLE.new('Excel.Application')
xl.visible = true
book = xl.workbooks.add
start = Time.now
sheet = book.worksheets(1)
1.upto(10000) do |row|
cells = sheet.Range(sheet.Cells(row, 1), sheet.Cells(row, 26))
values = cells.Value
26.times do |col|
if row.even?
values[0][col] = 3
else
values[0][col] = 'こんにちは'
end
end
cells.Value = values
end
puts "Elapsed time: #{Time.now - start} secs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment