Google::RestApi::SheetsApi4::Range::Iterator - An iterator for an arbitrary Range.


A Range::Iterator is used to iterate through a range, returning each cell, one at a time.

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.

 range: The Range object for which we are iterating.
 dim: The direction of the iteration ('col' or 'row'). The default is 'row'.
 by: The number of cells to skip between each iteration.

'dim' is used to specify which major dimension is used for the iteration. For a given range 'A1:B2', a 'dim' of 'col' will return A1, A2, B1, B2 for each successive iteration. For a 'dim' of 'row', it will return A1, B1, A2, B2 for each successive iteration.

'by' is used to allow you to only return, say, every second cell in the iteration ('by' = '2'). For a given range 'A1:B4' and a 'by' of '2', it will return A1, A3, B1, B3 for each succesive iteration.

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


Return the next cell in the iteration sequence.


An alias for iterate().


Returns the Range object for this iterator.


# Returns the Worksheet 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.