Skip to content

Instantly share code, notes, and snippets.

@stephen-lazaro
Created October 4, 2018 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephen-lazaro/cd8e84efda7ef887d1afd4a624309011 to your computer and use it in GitHub Desktop.
Save stephen-lazaro/cd8e84efda7ef887d1afd4a624309011 to your computer and use it in GitHub Desktop.
final case class Loan(
  id: Int,
  balance: Double,
  loanState: String
)
val workbook = WorkbookFactory.create(i).getSheetAt(0)
val idIndex = 0
val balanceIndex = 1
val loanStateIndex = 2
val balances: Iterator[Balance] = sheet.iterator()
 .asScala
 .map(row => {
  val id = row.getCell(idIndex).toInt
  val balance = row.getCell(balanceIndex).toDouble
  val loanState = row.getCell(loanStateIndex)
Loan(id, balance, loanState)
  })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment