[bug] Account for empty rows when updating the sheet
nfrankel opened this issue · comments
class Result(values: Collection<Any>) {
private val majorDimension: String
private val range: String
private val rows: List<ResultRow>
init {
val wrapper: List<Any> = ArrayList(values)
majorDimension = wrapper[0] as String
range = wrapper[1] as String
rows = (wrapper[2] as List<List<Any>>)
.mapIndexed { index, values -> ResultRow(index + 3, values) }
}
In the above code, rows can contain empty arrays if there data rows are non-contiguous.
I should filter them out to avoid unwanted bug.
![Breaks the code](https://private-user-images.githubusercontent.com/752258/250650903-6e8f2e6b-4952-4ee7-a595-38138deed1e2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1NTA5MzMsIm5iZiI6MTcyNDU1MDYzMywicGF0aCI6Ii83NTIyNTgvMjUwNjUwOTAzLTZlOGYyZTZiLTQ5NTItNGVlNy1hNTk1LTM4MTM4ZGVlZDFlMi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODI1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyNVQwMTUwMzNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mNWViYmZkMGY3YmUwODdlY2RjY2MxMzU1MTE5NzgyMTMyOTIyN2JjZjM4ZWFmMTc2NmI1OWE4YTAzYmE0ZTgwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.fLH2WyRt6p-C7NfJayBJ_fGV0kPIPaXbR9-YR3rbXlU)