You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
479 B
19 lines
479 B
class Ecs::ImportStudentExcel < BaseImportExcel
|
|
def read_each(&block)
|
|
2.upto(sheet.last_row) do |row_num|
|
|
data = sheet.row(row_num)
|
|
|
|
number = data[0].to_s.strip
|
|
name = data[1].to_s.strip
|
|
next if number.blank?
|
|
|
|
block.call(number, name)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def check_sheet_valid!
|
|
raise_import_error('请按照模板格式导入') if sheet.cell(1, 1) != '学号(必填)' || sheet.cell(1, 2) != '姓名'
|
|
end
|
|
end |