1,2ヶ月に1回くらいの頻度で書いている気がするのでメモ。
※下のコメントにあるライブラリ利用がオススメ↓
file_name = './hogehoge.csv'
file = File.open(file_name, 'r').read
rows = file.split("\n")
# ヘッダーを削除
rows.shift
rows.each do |row|
ary = row.split(',')
# do something
end
More than 5 years have passed since last update.
1,2ヶ月に1回くらいの頻度で書いている気がするのでメモ。
※下のコメントにあるライブラリ利用がオススメ↓
file_name = './hogehoge.csv'
file = File.open(file_name, 'r').read
rows = file.split("\n")
# ヘッダーを削除
rows.shift
rows.each do |row|
ary = row.split(',')
# do something
end
Register as a new user and use Qiita more conveniently