class Ecs::ImportCourseExcel < BaseImportExcel
  def read_each(&block)
    2.upto(sheet.last_row) do |row_num|
      name = sheet.row(row_num)[0].to_s.strip
      next if name.blank?

      block.call(name)
    end
  end

  private

  def check_sheet_valid!
    raise_import_error('请按照模板格式导入') if sheet.cell(1, 1) != '课程名称（必填）'
  end
end