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 (cells 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 cells 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 Cell.
Returns Future null if there are no columns.
Throws GSheetsException.
Implementation
Future<List<Cell>?> lastColumn({
int fromRow = 1,
int length = -1,
bool inRange = false,
}) async {
if (inRange) {
final columns = await _ws.values.allColumns(
fromRow: fromRow,
length: length,
);
if (columns.isEmpty) return null;
return _wrapColumn(columns.last, columns.length, fromRow);
} else {
checkIndex('fromRow', fromRow);
final columns = await _ws.values.allColumns();
if (columns.isEmpty) return null;
final list = extractSublist(
columns.last,
from: fromRow - 1,
length: length,
);
return _wrapColumn(list, columns.length, fromRow);
}
}