Fill Down values from a 1×6 array into an _x6 array Google App Script for Google Sheet


I’ve got this:

array_to_fill_down = [a, b, c, cat, 15, blue]
rows = 3

What I want is this:

{a, b, c, cat, 15, blue},
{a, b, c, cat, 15, blue},
{a, b, c, cat, 15, blue}

Sorry, I know I’m probably not using the correct symbols. That’s part of my problem, I’m sure.



Probably something like this:

array_to_fill_down = ['a', 'b', 'c', 'cat', 15, 'blue'];
rows = 3;

var new_array = [];
while (rows--) new_array.push(array_to_fill_down)


var new_array = new Array(rows).fill(array_to_fill_down);

Not sure if I understand your goal, though.

Answered By – Yuri Khristich

Answer Checked By – Terry (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.