Reputation: 36205
I'm trying to use appscript aheets setvalues() to paste a row of headers into a sheet.I have:
var headingsArray = []
headingsArray.push(["A", "B", "C", "D", "E", "F"]);
Logger.log(headingsArray)
sheet.getRange(3,1,3,6).setValues(headingsArray);
getting the error in title.
What am I doing wrong?
Upvotes: 1
Views: 779
Reputation: 2004
You trying to set values that are 1 row 6 columns large to a range of 3 row 6 columns. You should change your range to :
sheet.getRange(3,1,1,6).setValues(headingsArray);
since
setValues(values)
Sets a rectangular grid of values (must match dimensions of this range).
See getRange() method and setValues() method
Upvotes: 3