Sunday 30 December 2018

Push items into an empty array

The following Google Apps Script code is an example of how to push items into an empty array. In this example I simply use two arrays to explain the process but in reality I use it when collecting data from spreadsheets that is to then be copied elsewhere - eg looping through students of a particular criteria to then create a new Google sheet containing just them.

The script starts by creating an empty array to eventually push the items into. An array called age has the items we are going to push - but remember this could be formed by getting data from a spreadsheet. It then loops through each item in age and 'push'es it into students.

No comments:

Post a Comment