rowByKey method
Fetches row by its name.
Expands current sheet's size if requested range is out of sheet's bounds.
key
- name of a requested row
The column A considered to be row names
fromColumn
- optional (defaults to 2), index of a column that requested row
starts from (cells before fromColumn
will be skipped),
columns start at index 1 (column A)
length
- optional (defaults to -1), the length of a requested row
if length is -1
, all cells starting from fromColumn
will be returned
Returns row as Future List of Cell.
Throws GSheetsException.
Implementation
Future<List<Cell>?> rowByKey(
dynamic key, {
int fromColumn = 2,
int length = -1,
}) async {
final rKey = parseKey(key);
checkIndex('fromColumn', fromColumn);
final rows = await _ws.values.allRows();
final rowIndex = whereFirst(rows, rKey);
if (rowIndex < 0) return null;
final list = extractSublist(
rows[rowIndex],
from: fromColumn - 1,
length: length,
);
return _wrapRow(list, rowIndex + 1, fromColumn);
}