Google::RestApi::SheetsApi4::RangeGroup::Iterator - An iterator for a group of Ranges.


A RangeGroup::Iterator is used to iterate through a range group, returning a range group of cells, one group at a time.

Iterating over a range group assumes the range group is made up of a series of ranges that implement a 'cell' subroutine. This 'cell' routine is called on each iteration to return a Cell object that represents that iteration at a particular offset. The offset increases for each iteration.

See the description and synopsis at Google::RestApi::SheetsApi4.


new(range => <Range>, dim => <dimension>, by => <int>);

Creates a new Iterator object for the given range group.

 range_group: The parent range group for this iterator.
 by: The number of cells to skip between each iteration. Defaults to 1.
 from: The offset from which to start the iteration. Defaults to 0.
 to: The offset to stop the iteration. No default.

'by' is used to allow you to only return, say, every second cell in the iteration ('by' = '2').

If you don't specify a 'to' then you will need to have a method to end the iteration yourself (e.g. 'last if cell value eq ""') or you will iterate off the end of the sheet and get a 403 back.

You would not normally call this directly, you'd use the RangeGroup::iterator method to create the iterator object for you.


Return the next group of cells in the iteration sequence.


An alias for iterate().


Returns the RangeGroup object for this iterator.


Returns the Spreadsheet object for this iterator.


  • Robin Murray


Copyright (c) 2019, Robin Murray. All rights reserved.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.