insertColumns method
Updates columns with values from maps
.
Expands current sheet's size if inserting range is out of sheet's bounds.
maps
- list of maps containing values to insert (not null nor empty)
column
- column index to insert values of maps
to,
columns start at index 1 (column A)
fromRow
- optional (defaults to 1), row index for the first inserted value,
rows start at index 1
mapTo
- optional (defaults to 1), index of a column to which
keys of the maps
will be mapped to,
columns start at index 1 (column A)
appendMissing
- optional (defaults to false
), whether keys of maps
(with its related values) that are not present in a mapTo
column
should be added
overwrite
- optional (defaults to false
), whether clear cells of
column
if maps
does not contain value for them
Returns Future true
in case of success.
Throws GSheetsException.
Implementation
Future<bool> insertColumns(
int column,
List<Map<String, dynamic>> maps, {
int fromRow = 1,
int mapTo = 1,
bool appendMissing = false,
bool overwrite = false,
}) async {
checkIndex('column', column);
checkMapTo(row, mapTo);
checkMaps(maps);
final keys = await _values.column(mapTo);
return _insertColumns(
column,
maps,
keys,
fromRow,
mapTo,
appendMissing,
overwrite,
);
}