Created
February 9, 2011 03:18
-
-
Save jun66j5/817825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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