It’s a pretty common requirement, especially when you’re posting to an API, to split an array of data into manageable chunks, and most often the solution is to make an array of arrays – with each one being up to a maximum size. That’s fine, but we can also make an iterator.
Let’s take a look at how these approaches differ, and take a look into iterators – a very interesting addition to Apps Script as a result of v8.
It’s a pretty common requirement, especially when you’re posting to an API, to split an array of data into manageable chunks, and most often the solution is to make an array of arrays – with each one being up to a maximum size. That’s fine, but we can also make an iterator.
Let’s take a look at how these approaches differ, and take a look into iterators – a very interesting addition to Apps Script as a result of v8.
https://ramblings.mcpher.com/gassnippets2/iterator-magic-splitting-an-array-into-chunks/