Currently we have asymmetric interface between read and write tabular data :
Read :
File(pathTo("simple_data.xlsx")).inputStream().use {
val columns = object:RetableColumns() {
val FIRST_NAME = string("first_name", index = 2)
val LAST_NAME = string("last_name", index = 1)
val AGE = int("age", index = 3)
}
val retable = Retable
.csv(columns)
.read(it)
}
Write :
val columns = object:RetableColumns() {
val FIRST_NAME = string("first_name", index = 2)
val LAST_NAME = string("last_name", index = 1)
val AGE = int("age", index = 3)
}
Retable(columns)
.data(
listOf(
Person("John", "Doe", 23),
Person("Jenny", "Boe", 25)
)
) {
mapOf(
FIRST_NAME to it.firstName,
LAST_NAME to it.lastName,
AGE to it.age
)
}
.write(Retable.excel(columns) to File(pathTo("export_data_cols.xlsx")).outputStream())
It's would better to have same code to read and write a file until we call read or write method.
Currently we have asymmetric interface between read and write tabular data :
Read :
Write :
It's would better to have same code to read and write a file until we call read or write method.