This sample script is for straightening elements in 2 dimensional array using Google Apps Script (GAS). When applications using Spreadsheet are developed by GAS, it usually uses 2 dimensional array by setValues()
. And the lengths of each element are required to be the same. On the other hand, data used for the applications might not be the same length for each element in 2 dimensional array. This sample script can be used under such situation.
var data = [
["string"],
["string", "string", "string", "string", "string"],
["string", "string", "string"],
["string", "string", "string", "string", "string"],