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.
20 lines
436 B
20 lines
436 B
class Admins::ImportUserExcel < BaseImportXlsx
|
|
UserData = Struct.new(:name, :phone, :mail, :school, :department, :identity, :student_id)
|
|
|
|
def read_each(&block)
|
|
sheet.each_row_streaming(pad_cells: true, offset: 1) do |row|
|
|
data = row.map(&method(:cell_value))[0..7]
|
|
block.call UserData.new(*data)
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def check_sheet_valid!
|
|
end
|
|
|
|
def cell_value(obj)
|
|
obj&.cell_value&.presence
|
|
end
|
|
end
|