rowIndexOf method
Returns index of a row with key value in inColumn.
Expands current sheet's size if requested range is out of sheet's bounds.
key - value to look for
inColumn - optional (defaults to 1), column index in which key is
looked for,
columns start at index 1 (column A)
add - optional (defaults to false), whether the key should be added
to inColumn in case of absence
Returns Future -1 if key is not found and add is false.
Throws GSheetsException.
Implementation
Future<int> rowIndexOf(
Object key, {
bool add = false,
inColumn = 1,
}) async {
final rKey = parseKey(key);
final rowKeys = await column(inColumn);
var row = rowKeys.indexOf(rKey) + 1;
if (row < 1) {
row = -1;
if (add) {
await _ws._update(
values: [rKey],
range: await _ws._columnRange(inColumn, rowKeys.length + 1, 1),
majorDimension: dimenColumns,
);
row = rowKeys.length + 1;
}
}
return row;
}