insertRows method

Future<bool> insertRows(
  1. int row,
  2. List<Map<String, dynamic>> maps, {
  3. int fromColumn = 1,
  4. int mapTo = 1,
  5. bool appendMissing = false,
  6. bool overwrite = false,
})

Updates rows 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)

row - row index to insert values of maps to, rows start at index 1

fromColumn - optional (defaults to 1), column index for the first inserted value, columns start at index 1 (column A)

mapTo - optional (defaults to 1), index of a row to which keys of the maps will be mapped to, rows start at index 1

appendMissing - optional (defaults to false), whether keys of maps (with its related values) that are not present in a mapTo row should be added

overwrite - optional (defaults to false), whether clear cells of row if map of maps does not contain value for them

Returns Future true in case of success.

Throws GSheetsException.

Implementation

Future<bool> insertRows(
  int row,
  List<Map<String, dynamic>> maps, {
  int fromColumn = 1,
  int mapTo = 1,
  bool appendMissing = false,
  bool overwrite = false,
}) async {
  checkIndex('row', row);
  checkMapTo(row, mapTo);
  checkMaps(maps);
  final keys = await _values.row(mapTo);
  return _insertRows(
    row,
    maps,
    keys,
    fromColumn,
    mapTo,
    appendMissing,
    overwrite,
  );
}