I'm working on a Google Sheets and I'm trying to store an column of integers in an array, then clear a column on the sheet and then print the array of integers to a column on the sheet. Please see below for code...
function myFunction1() {
//Declaring the Active Sheet
var mySheet = SpreadsheetApp.getActiveSheet();
//Declaring the range that will make up the Array
var myRange = mySheet.getRange("E10:E328");
//Declaring Array
var myArray = [[myRange.getValues()]];
//Clearing a range on the Google Sheet
mySheet.getRange('A10:A328').clearContent();
//Printing Array to Google Sheet
mySheet.getRange(15, 5).setValues([myArray]);
}
The above code runs without any errors but does not print my array to the sheet. I've been working on this for a while and have used the following articles to try to fix it...
https://productforums.google.com/forum/#!topic/docs/t99laH0rFc0
Incorrect Range Height - Google Script
Writing 1D array into a sheet column in Apps Script
https://developers.google.com/apps-script/reference/spreadsheet/range#setvaluesvalues
Common errors that i have had when writing the code up to this point is, "Incorrect Range Height" and "Cannot convert Array to Object[][]".
How would i fix this so that my Array prints to the column on the sheet?
Thanks for your time! Any help on this would be great!!