DevoxxFR 2024 Reproducible Builds with Apache Maven
名古屋Ruby会議01 - Rubyでライフハッキング10連発♪
1.
2.
3.
4.
5.
6.
7. require 'win32ole'
app = WIN32OLE.new('Excel.Application')
book = app.Workbooks.Open(app.GetOpenFilename)
for row in book.ActiveSheet.UsedRange.Rows do
for cell in row.Columns do
p cell.Name
p cell.Age
end
end
book.close(false)
app.quit
via http://jp.rubyist.net/magazine/?0027-ExcellentRuby
8. require "yaml"
people = []
for row in book.ActiveSheet.UsedRange.Rows
do
for cell in row.Columns do
people << {:name => cell.Name, :age =>
cell.Age}
end
end
File.open 'people.yml', 'w' do |file|
YAML.dump(people, file)
end
9. require 'yaml'
people = YAML.load_file 'people.yml'
people.each do |person|
p = Person.new person
p.save
end
import.rb
ruby script/runner import.rb