column method
Fetches specified column, maps it to other column and returns map.
Expands current sheet's size if requested range is out of sheet's bounds.
column
- index of a requested column (values of returned map),
columns start at index 1 (column A)
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
mapTo
- optional (defaults to 1), index of a column to map cells to
(keys of returned map),
columns start at index 1 (column A)
Returns column as Future Map of String to Cell.
Throws GSheetsException.
Implementation
Future<Map<String, Cell>> column(
int column, {
int mapTo = 1,
int fromRow = 1,
int length = -1,
}) async {
checkIndex('column', column);
checkIndex('mapTo', mapTo);
checkMapTo(column, mapTo);
final columns = await _cells._ws.values.allColumns(
fromRow: fromRow,
length: length,
);
final keys = get(columns, at: mapTo - 1, or: <String>[])!;
final values = get(columns, at: column - 1, or: <String>[])!;
return _wrapColumn(keys, values, column, fromRow);
}