lastColumn method
Fetches last column.
Expands current sheet's size if requested range is out of sheet's bounds.
fromRow
- optional (defaults to 1), index of a row that requested column
starts from (values before fromRow
will be skipped),
rows start at index 1
length
- optional (defaults to -1), the length of a requested column
if length is -1
, all values starting from fromRow
will be returned
inRange
- optional (defaults to false), whether should be fetched last
column in range (respects fromRow
and length
) or last column in table
Returns last column as Future List of String.
Returns Future null
if there are no columns.
Throws GSheetsException.
Implementation
Future<List<String>?> lastColumn({
int fromRow = 1,
int length = -1,
bool inRange = false,
}) async {
if (inRange) {
final columns = await allColumns(
fromRow: fromRow,
length: length,
);
if (columns.isEmpty) return null;
return columns.last;
} else {
checkIndex('fromRow', fromRow);
final columns = await allColumns();
if (columns.isEmpty) return null;
return extractSublist(
columns.last,
from: fromRow - 1,
length: length,
);
}
}