com.colisweb.gdrive.client.sheets.GoogleSpreadsheet.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of google-drive-scala-client_2.13 Show documentation
Show all versions of google-drive-scala-client_2.13 Show documentation
Google Drive Scala Client is a Scala wrapper around the Google Drive client for Java
The newest version!
package com.colisweb.gdrive.client.sheets
import eu.timepit.refined.types.numeric.NonNegInt
final case class GoogleSpreadsheet(
rows: List[SpreadsheetRow]
) {
override def toString: String = {
val rowsString = rows.map(r => s"${r.index}:${r.cells.mkString("|")}")
"Spreadsheet(" + rowsString.mkString(";") + ")"
}
}
final case class SpreadsheetRow(
index: NonNegInt,
cells: Map[String, String]
) {
def isCellBlank(columnName: String): Boolean =
cells.get(columnName).forall(value => isBlank(value))
def getCellOption(columnName: String): Option[String] =
cells.get(columnName)
def getCellOptionNonBlank(columnName: String): Option[String] =
cells.get(columnName).filterNot(isBlank)
private def isBlank(value: String) = value.isEmpty || value.isBlank
}